home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / POV-Ray 2.2 / POVDOC / DOCS / POVRAY.DOC next >
Encoding:
Text File  |  1993-10-01  |  256.0 KB  |  6,031 lines  |  [TEXT/R*ch]

  1.   2.2.2   APPLE MACINTOSH
  2.         2.2.3   COMMODORE AMIGA
  3.         2.2.4   UNIX AND OTHER SYSTEMS
  4.         2.2.5   ALL VERSIONS
  5.  
  6.     2.3 WHERE TO FIND POV-Ray FILES
  7.  
  8.         2.3.1   GRAPHICS DEVELOPER'S FORUM ON COMPUSERVE
  9.         2.3.2   PC GRAPHICS AREA ON AMERICA ON-LINE
  10.         2.3.3   YOU CAN CALL ME RAY BBS IN CHICAGO
  11.         2.3.4   THE GRAPHICS ALTERNATIVE BBS IN EL CERRITO, CA
  12.         2.3.5   PI SQUARED BBS MARYLAND
  13.         2.3.6   INTERNET
  14.  
  15. 3.0 QUICK START
  16.  
  17.     3.1 INSTALLING POV-Ray
  18.  
  19.     3.2 USING SAMPLE SCENES
  20.  
  21.     3.3 COMMAND LINE PARAMETERS
  22.  
  23.         3.3.1   ANTI-ALIASING
  24.         3.3.2   BUFFERING
  25.         3.3.3   CONTINUING INTERRUPTED TRACE
  26.         3.3.4   DISPLAY PREVIEW IMAGE
  27.         3.3.5   RENDER PARTIAL IMAGE
  28.         3.3.6   FILE OUTPUT TYPE
  29.         3.3.7   HEIGHT AND WIDTH OF IMAGE
  30.         3.3.8   INPUT AND OUTPUT FILE NAMES
  31.         3.3.10  ANIMATION CLOCK VARIABLE
  32.         3.3.11  LIBRARY SEARCH PATH
  33.         3.3.12  BOUNDING SLABS CONTROL
  34.         3.3.13  SYMBOL TABLE SIZE
  35.         3.3.14  VERSION COMPATIBILITY MODE
  36.         3.3.15  PAUSE WHEN FINISHED
  37.         3.3.16  QUALITY SETTINGS
  38.         3.3.17  VERBOSE STATISTICS
  39.         3.3.18  ALLOW ABORTED RENDERING
  40.  
  41.     3.4 DEFAULT PARAMETER FILE AND ENVIRONMENT VARIABLE
  42.  
  43. 4.0 BEGINNING TUTORIAL
  44.  
  45.     4.1 YOUR FIRST IMAGE
  46.  
  47.         4.1.1   THE POV-Ray COORDINATE SYSTEM
  48.         4.1.2   ADDING STANDARD INCLUDE FILES
  49.         4.1.3   PLACING THE CAMERA
  50.         4.1.4   DESCRIBING AN OBJECT
  51.         4.1.5   ADDING TEXTURE TO AN OBJECT
  52.         4.1.6   DEFINING A LIGHT SOURCE
  53.  
  54.     4.2 MORE TEXTURE OPTIONS
  55.  
  56.         4.2.1   SURFACE FINISHES
  57.         4.2.2   ADDING BUMPINESS
  58.         4.2.3   CREATING COLOR PATTERNS
  59.         4.2.4   PRE-DEFINED TEXTURES
  60.  
  61.     4.3 MORE SHAPES
  62.  
  63.         4.3.1   PLANE OBJECT
  64.         4.3.2   BOX OBJECT
  65.         4.3.3   CONE OBJECT
  66.         4.3.4   CYLINDER OBJECT
  67.  
  68. 5.0 SCENE DESCRIPTION LANGUAGE REFERENCE
  69.  
  70.     5.1 LANGUAGE BASICS
  71.  
  72.         5.1.1   IDENTIFIERS AND KEYWORDS
  73.         5.1.2   COMMENTS
  74.         5.1.3   INCLUDE FILES
  75.         5.1.4   FLOAT EXPRESSIONS
  76.         5.1.5   VECTOR EXPRESSIONS
  77.         5.1.6   TRANSFORMATIONS
  78.                 5.1.6.1 Translate
  79.                 5.1.6.2 Scale
  80.                 5.1.6.3 Rotate
  81.                 5.1.6.4 Transforming Textures and Objects
  82.                 5.1.6.5 Transformation Order
  83.         5.1.7   DECLARE
  84.  
  85.     5.2 OBJECTS
  86.  
  87.         5.2.1   SOLID FINITE PRIMITIVES
  88.                 5.2.1.1 Spheres
  89.                 5.2.1.2 Boxes
  90.                 5.2.1.3 Cylinders
  91.                 5.2.1.4 Cones
  92.                 5.2.1.5 Torus
  93.                 5.2.1.6 Blob
  94.                 5.2.1.7 Height Fields
  95.         5.2.2   FINITE PATCH PRIMITIVES
  96.                 5.2.2.1 Triangle and Smooth_triangle 
  97.                 5.2.2.2 Bicubic_patch
  98.                 5.2.2.3 Disc
  99.         5.2.3   INFINITE SOLID PRIMITIVES
  100.                 5.2.3.1 Plane 
  101.                 5.2.3.2 Quadric 
  102.                 5.2.3.3 Poly, Cubic and Quartic.  
  103.         5.2.4   CONSTRUCTIVE SOLID GEOMETRY (CSG)
  104.                 5.2.4.1 About CSG
  105.                 5.2.4.2 Inside and outside
  106.                 5.2.4.3 Union  
  107.                 5.2.4.4 Intersection
  108.                 5.2.4.5 Difference
  109.                 5.2.4.6 Merge
  110.         5.2.5   LIGHT SOURCES
  111.                 5.2.5.1 Point Lights
  112.                 5.2.5.2 Spotlights
  113.                 5.2.3.3 Area Lights
  114.                 5.2.3.4 Looks_like
  115.  
  116.     5.3 OBJECT MODIFIERS
  117.  
  118.         5.3.1   CLIPPED_BY
  119.         5.3.1   BOUNDED_BY
  120.         5.3.2   NO_SHADOW
  121.  
  122.     5.4 TEXTURES
  123.  
  124.         5.4.1   PIGMENT
  125.                 5.4.1.1 Color
  126.                 5.4.1.2 Color List Patterns -- checker and hexagon
  127.                 5.4.1.3 Color Mapped Patterns
  128.                         5.4.1.3.1   Gradient 
  129.                         5.4.1.3.2   Color Maps
  130.                         5.4.1.3.3   Marble
  131.                         5.4.1.3.4   Wood
  132.                         5.4.1.3.5   Onion
  133.                         5.4.1.3.6   Leopard 
  134.                         5.4.1.3.7   Granite 
  135.                         5.4.1.3.8   Bozo 
  136.                         5.4.1.3.9   Spotted 
  137.                         5.4sing the 286 CPU is also available in the self-extracting 
  138. archive POV286.EXE.
  139.  
  140.  
  141. 2.2.2 APPLE MACINTOSH
  142.  
  143. The Apple Macintosh version of POV-Ray can be found in the archive 
  144. POVMAC.SEA or POVMNF.SEA.  POVMAC.SEA contains the preferred "high-
  145. performance" executable for Macs with a floating point coprocessor (FPU).  
  146. POVMNF.SEA contains the slower more universal executable, which will run on 
  147. any 68020 or better Mac without an FPU.  
  148.  
  149. The Macintosh version of POV-Ray needs a 68020 or better CPU (Mac II 
  150. series, SE/30, Quadras, some Powerbooks, etc.)  It will run under Sytem 
  151. 6.0.4 or newer (System 7 preferred.)  It also requires 32 bit Color 
  152. Quickdraw, which is built into System 7, and is an optional init in System 
  153. 6.  The init can be found on the System 6 System disk "Printing", under the 
  154. "Apple Color" folder.  It should also be available from any authorized 
  155. Apple Service Center, or CompuServe or local Macintosh bulletin boards.  
  156. QuickTime 1.5 or newer is preferred but not required.  If installed, it 
  157. will allow compression of the final PICT images.  It will also allow adding 
  158. custom System 7 Thumbnail icons to the PICT files in the Finder.  Of 
  159. course, a color monitor is preferred, but not required.
  160.  
  161. 2.2.3 COMMODORE AMIGA
  162.  
  163. The Commodore Amiga version of POV-Ray can be found in the file POVAMI.LZH. 
  164. Two executables are supplied, one for computers with a math co-processor, 
  165. and one for computers without a math co-processor. This version will run on 
  166. Amiga 500, 1000, 2000, and 3000's and should work under AmigaDOS 1.3 or 
  167. 2.xx.  The Amiga version supports HAM mode as well as HAM-E and the 
  168. Firecracker.
  169.  
  170.  
  171. 2.2.4 UNIX AND OTHER SYSTEMS
  172.  
  173. POV-Ray is written in highly portable C source code and it can be compiled 
  174. and run on many different computers.  There is specific source code in the 
  175. source archive for UNIX, X-Windows, VAX, and generic computers. If you have 
  176. one of these, you can use the C compiler included with your operating 
  177. system to compile a POV-Ray executable for your own use. This executable 
  178. may not be distributed except under the terms specified in the file 
  179. POVLEGAL.DOC.  Users on high powered computers like Suns, SGI, RS-6000's, 
  180. Crays, and so on use this method to run POV-Ray.
  181.  
  182.  
  183. 2.2.5 ALL VERSIONS
  184.  
  185. All versions of the program share the same ray tracing features like 
  186. shapes, lighting and textures. In other words, an IBM-PC can create the 
  187. same pictures as a Cray supercomputer as long as it has enough memory.
  188.  
  189. The user will want to get the executable that best matches their computer 
  190. hardware. See the section "Where to find POV-Ray files" for where to find 
  191. these files. You can contact those sources to find out what the best 
  192. version is for you and your computer.
  193.  
  194.  
  195. 2.3   WHERE TO FIND POV-Ray FILES
  196. ---------------------------------
  197.  
  198. POV-Ray is a complex piece of software made up of many files. The POV-Ray 
  199. package is made up of several archives including executables, 
  200. documentation, and example scene files. 
  201.  
  202. The average user will need an executable for their computer, the example 
  203. scene files and the documentation. The example scenes are invaluable for 
  204. learning about POV-Ray, and they include some exciting artwork.
  205.  
  206. Advanced users, developers, or the curious may want to download the C 
  207. source code as well.
  208.  
  209. There are also many different utilities for POV-Ray that generate scenes, 
  210. convert scene information from one format to another, create new materials, 
  211. and so on. You can find these files from the same sources as the other POV-
  212. Ray files. No comprehensive list of these utilities is available at the 
  213. time of this writing.
  214.  
  215. The latest versions of the POV-Ray software are available from these 
  216. sources:
  217.  
  218.  
  219. 2.3.1 GRAPHICS DEVELOPER'S FORUM ON COMPUSERVE
  220.  
  221. POV-Ray headquarters are on CompuServe Graphics Developer's Forum (GO 
  222. GRAPHDEV) sections 8 POV Sources and 9 POV Images. We meet there to share 
  223. info and graphics and discuss ray tracing. The forum is also home to 
  224. development projects on fractals, animation and morphing.  It is the home 
  225. of the Stone Soup Group, developers of Fractint, a popular IBM-PC frac file text 
  226. describes objects and lights in the scene, and a camera to view the scene. 
  227. Scene files have the file extension .POV and can be created by any word 
  228. processor or editor that can save in standard ASCII text format.
  229.  
  230. Quite a few example scenes are provided with this distribution in the 
  231. example scenes archive. The scenes in the standard archives are designed to 
  232. illustrate and teach you the features of the program.  Additionally the 
  233. POV-Ray Team distributes several volumes of scenes in its ongoing series 
  234. "The POV-Ray Scene Library"  These scene files range from very simple to 
  235. very complex. They have been created by users of POV-Ray all over the 
  236. world, and were picked to give examples of the variety of features in POV-
  237. Ray. Many of them are stunning in their own right. 
  238.  
  239. The scenes were graciously donated by the artists because they wanted to 
  240. share what they had created with other users. Feel free to use these scenes 
  241. for any purpose. You can just marvel at them as-is, you can study the scene 
  242. files to learn the artists techniques, or you can use them as a starting 
  243. point to create new scenes of your own.
  244.  
  245. Here's how to make these sample scenes into images you can view on your 
  246. computer. We'll use SIMPLE.POV as an example, just substitute another 
  247. filename to render a different image.
  248.  
  249.    Note: The sequence of commands is not the same for
  250.          every version of POV-Ray. There should be a 
  251.          document with the executable describing the
  252.          specific commands to render a file.
  253.  
  254. The file SIMPLE.POV was included with the standard scene files and should 
  255. now be in the DEMO directory.  Make that the active directory, and then at 
  256. the command line, type:
  257.  
  258.   POVRAY +Isimple.pov +V +W80 +H60
  259.  
  260. POVRAY is the name of your executable, +Ifilename.pov tells POV-Ray what 
  261. scene file it should use as input, and +V tells the program to output its 
  262. status to the text screen as it's working. +W and +H set the width and 
  263. height of the image in pixels. This image will be 80 pixels wide by 60 
  264. pixels high.
  265.  
  266. POV-Ray will read in the text file SIMPLE.POV and begin working to render 
  267. the image. It will write the image to a file called DATA.TGA. The file 
  268. DATA.TGA contains a 24 bit image of the scene file SIMPLE.POV. Because many 
  269. computers can't display a 24 bit image, you will probably have to convert 
  270. DATA.TGA to an 8 bit format before you can view it on your computer. The 
  271. docs included with your executable lists the specific steps required to 
  272. convert a 24 bit file to an 8 bit file.
  273.  
  274.  
  275. 3.3   COMMAND LINE PARAMETERS
  276. -----------------------------
  277.  
  278. The following section gives a detailed description of the command-line 
  279. options.
  280.  
  281. The command-line parameters may be specified in any order. Repeated 
  282. parameters overwrite the previous values except for the +L switch which 
  283. defines include file library paths.  Up to 10 +L paths may be specified.  
  284. Default parameters may also be specified in a file called "povray.def" or 
  285. by the environment variable "POVRAYOPT". 
  286.  
  287. Switches may be specified in upper or lower case.  Switches must be 
  288. preceded by a + (plus) or - (minus).  In switches which toggle a feature, 
  289. the plus turns it on and minus turns it off.  For example +P turns on the 
  290. "pause for keypress when finished" option while -P turns it off.  Other 
  291. switches are used to specify values and do not toggle a feature.  Either 
  292. plus or minus may be used in that instance.  For example +W320 sets the 
  293. width to 320 pixels.  You could also use -W320 and get the same results.  
  294. More examples follow this table.
  295.  
  296. Table 1 Command Line Parameters
  297. Parameter......|.....Range........|...Description........................
  298. -------------------------------------------------------------------------
  299. +Annn          | 0.0 to 3.0       | Render picture with anti-aliasing,or 
  300.                |                  | "smoothing", on.  Lower values cause 
  301.                |                  | more smoothing.
  302. +A             |                  | Use default 0.3 anti-aliasing
  303. -A             |                  | Turn anti-aliasing off (default)
  304. +Bnnn or -Bnnn | Varies w/ sys    | Output file buffer size.
  305. +C             |                  | Continue an aborted partial image. 
  306. -C             |                  | Start rendering from first line.
  307. +Dxxx          | Varies w/sys     | Display image graphically while 
  308.                |                  | rendering (Not available on all vers).
  309. +Enn or +ERnn  | 1 to 32,767      | End row for tracing
  310.                |  or 0.0 to 1.0   | a portion of a scene.
  311. +ECnn          | 1 to 32,767      | End column for tracing
  312.                |  or 0.0 to 1.0   | a portion of a scene.
  313. +FT            |                  | Output Targa format file 
  314. +FD            |                  | Output dump format file 
  315. +FR            |                  | Output raw format file 
  316. -F             |                  | Disable file output.
  317. +Hnnn          | 1 to 32,767      | Height of image in pixels.
  318. +Ifilespec     | Varies w/ sys    | Input scene file name, generally ends 
  319.                |                  | in .pov.
  320. +Jnnn.nnn      | 0.0 to 1.0       | Set amount of jitter for anti-aliasing
  321. +J             |                  | Use anti-aliasing jitter 1.0 (default)
  322. -J             |                  | Turn off anti-aliasing jitter 
  323. +Knnn.nnn      | any real value   | Set "clock" float value for animation
  324. +Lpathspec     | Varies w/ sys    | Library path: POV-Ray will search for 
  325.                |                  | files in the directory listed here.
  326.                |                  | Multiple lib paths may be specified.
  327. -MB            |                  | Turn off bounding slabs
  328. +MBnnn         | 0 to 32,767      | Use bounding slabs if more than nnn
  329.                |                  | objects in scene.
  330. +MSnnn         | 300 or more      | Set symbol table size (default 1000)
  331. +MVn.m         | 1.0 or 2.0       | Set version compatibility mode
  332. +Ofilespec     | Varies w/ sys    | Output image filename.
  333. +P             |                  | Pause and wait for keypress after 
  334.                |                  | tracing image.
  335. -P             |                  | Don't pause
  336. +Qn            |   0 to 9         | Image quality: 9 highest(default) to
  337.                |                  | 0 lowest.
  338. +Rn or -Rn     |   1 to 9         | Use n*n rays for anti-aliasing. Default 
  339.                |                  | of 3 gives 9 rays; 4 gives 16 rays etc.
  340. +Snn or +SRnn  | 1-32,768         | Start row for tracing
  341.                |  or 0.0 to 1.0   | a portion of a scene.
  342. +SCnn          | 1-32,768         | Start column for tracing
  343.                |  or 0.0 to 1.0   | a portion of a scene.
  344. +Vnn           | Varies w/sys     | Display verbose image stats while
  345.                |                  | rendering. 
  346. -V             |                  | No stats during rendering
  347. +Wnnn          | 1-32,768         | Width of image in pixels.
  348. +X             |                  | Allow abort with keypress.(IBM-PC).
  349. -X             |                  | Disable abort with keypress.(IBM-PC).
  350. --------------------------------------------------------------
  351.  
  352.  
  353. 3.3.1 ANTI-ALIASING
  354.  
  355.       +Annn       Anti-alias with tolerance level nnn.
  356.       +A          Anti-alias with tolerance level 0.3
  357.       -A          Don't anti-alias (default)
  358.       +Jn.nn      Scale factor for jittering
  359.       +J          Jitter AA with scale 1.0 (default)
  360.       -J          Turn off jittering
  361.       +Rn or -Rn  Use n*n rays when anti-aliasing (default 3)
  362.  
  363. Anti-aliasing is a technique used to make the ray traced image look 
  364. smoother. Often the color difference between two objects creates a "jaggy" 
  365. appearance. When anti-aliasing is turned on, POV-Ray attempts to "smooth" 
  366. the jaggies by shooting more rays into the scene and averaging the results. 
  367. This technique can really improve the appearance of the final image. Be 
  368. forewarned though, anti-aliasing drastically slows the time required to 
  369. render a scene since it has do many more calculations to "smooth" the 
  370. image. Lower numbers mean more anti-aliasing and also more time. Use anti-
  371. aliasing for your final version of a picture, not the rough draft.
  372.  
  373. The +A option enables adaptive anti-aliasing. The number after the +A 
  374. option determines the threshold for the anti-aliasing. 
  375.  
  376. If the color of a pixel differs from its neighbor (to the left or above) by 
  377. more than the threshold, then the pixel is subdivided and super-sampled. If 
  378. r1,g1,b1 and r2,g2,b2 are the rgb components of two pixels then the 
  379. difference between pixels is computed by:
  380.  
  381.     diff=abs(r1-r2)+abs(g1-g2)+abs(b1-b2)
  382.  
  383. The rgb values are in the range 0.0 to 1.0 thus the most two pixels can 
  384. differ is 3.0.  If the anti-aliasing threshold is 0.0, then every pixel is 
  385. super-sampled. If the threshold is 3.0, then no anti-aliasing is done. 
  386.  
  387. The lower the contrast, the lower the threshold should be. Higher contrast 
  388. pictures can get away with higher tolerance values.
  389.  
  390. Good values seem to be around 0.2 to 0.4.
  391.  
  392. The super-samples are jittered to introduce noise and to eliminate moire 
  393. interference patterns. Note that the jittering "noise" is non-random and 
  394. repeatable in nature, based on an object's 3-D orientation in space. Thus, 
  395. it's okay to use anti-aliasing for animation sequences, as the anti-aliased 
  396. pixels won't vary and flicker annoyingly from frame to frame.  The +Jnn.nn 
  397. switch scales down the amount of jitter from its default value 1.0.  For 
  398. example +J0.5 uses half the normal jitter.  Values over 1.0 jitter outside 
  399. the pixel bounds and are not recommended.  Use -J to turn off jittering.
  400.  
  401. The +R switch controls the number of rows and columns of rays per pixel 
  402. with anti-aliasing.  The default value 3 gives 3x3=9 rays per pixel.
  403.  
  404. The jittering and multiple rays are only used when +A is on.
  405.  
  406.  
  407. 3.3.2 BUFFERING
  408.  
  409.       +Bnnn       Use an output file buffer of nnn kilobytes. 
  410.       -Bnnn       Same as +Bnnn
  411.  
  412. The +B option allows you to assign large buffers to the output file. This 
  413. reduces the amount of time spent writing to the disk. If this parameter is 
  414. not specified, then as each scanline is finished, the line is written to 
  415. the file and the file is flushed. On most systems, this operation insures 
  416. that the file is written to the disk so that in the event of a system crash 
  417. or other catastrophic event, at least part of the picture has been stored 
  418. properly and retrievable on disk. (see also the +C option below.)  A value 
  419. of +B30 is a good value to use to speed up small renderings.  A value of 
  420. +B0 defaults to a small system-dependent buffer size.  Note neither +B0 nor 
  421. -B turns this feature off.  Once a buffer is set, subsequent +B commands 
  422. can change its size but cannot turn it off.
  423.  
  424.  
  425. 3.3.3 CONTINUING INTERRUPTED TRACE
  426.  
  427.       +C          Continue partially complete rendering
  428.       -C          Render from beginning (default)
  429.  
  430. If you abort a render while it's in progress or if you used the +E or +ER 
  431. options to end the render prematurely, you can use the +C option to 
  432. continue the render when you get back to it. This option reads in the 
  433. previously generated output file, displays the image to date on the screen, 
  434. then proceeds with the ray tracing. This option cannot be used if file 
  435. output is disabled with -F.  It does not work with +S, +SR, +SC or +EC 
  436. switches.
  437.  
  438.  
  439. 3.3.4 DISPLAY PREVIEW IMAGE
  440.  
  441.       +D          Use preview display
  442.       -D          Turn preview display off (default)
  443.  
  444. If the +D option is used and your computer supports a graphic display, then 
  445. the image will be displayed while the program performs the ray tracing. On 
  446. most systems, the picture displayed is not as good as the one created by 
  447. the post-processor because it does not try to make optimum choices for the 
  448. color registers. 
  449.  
  450. The +D parameters are system-dependent and are listed in the executable 
  451. documentation.
  452.  
  453.  
  454. 3.3.5 RENDER PARTIAL IMAGE
  455.  
  456.       +Snnn or +SRnnn   Start tracing at row number nnn.
  457.       +SCnnn            Start tracing at column number nnn.
  458.       +Ennn or +ERnnn   End tracing at row number nnn.
  459.       +ECnnn            End tracing at column number nnn.
  460.  
  461. When doing test rendering it is often convenient to define a rectangular 
  462. section of the whole screen so you can quickly check out one area of the 
  463. image.  The +S and +E switches let you define starting and ending rows and 
  464. columns for partial renderings.
  465.  
  466. The +S and +E options also allow you to begin and end the rendering of an 
  467. image at a specific scan line so you can render groups of scanlines on 
  468. different systems and concatenate them later.
  469.  
  470. WARNING: Image files created on with different executables on the same or 
  471. different computers may not look exactly the same due to different random 
  472. number generators used in some textures. If you are merging output files 
  473. from different systems, make sure that the random number generators are the 
  474. same. If not, the textures from one will not blend in with the textures 
  475. from the other. 
  476.  
  477. Note if the number following +SR, +SC, +ER or +EC is a greater 1 then it is 
  478. interpreted as a number of pixels.  If it is a decimal value between 0.0 
  479. and 1.0 then it is interpreted as a percent of the total width or height of 
  480. the image.  For example: +SR0.75 +SC0.75 starts on a row 75% down from the 
  481. top at a column 75% from the left and thus renders only the lower-right 25% 
  482. of the image.
  483.  
  484.  
  485. 3.3.6 FILE OUTPUT TYPE
  486.  
  487.       +FT         Uncompressed Targa-24 format (IBM-PC Default)
  488.       +FD         Dump format (QRT-style)
  489.       +FR         Raw format - one file each for Red, Green and Blue. 
  490.       +F          Use default file type for your system
  491.       -F          Turn off file output
  492.  
  493. Normally, you don't need to specify any form of +F option. The default 
  494. setting will create the correct format image file for your computer. The 
  495. docs included with the executable specify which format is used.
  496.  
  497. You can disable image file output by using the command line option -F. This 
  498. is only useful if your computer has display options and should be used in 
  499. conjunction with the +P option. If you disable file output using -F, there 
  500. will be no record kept of the image file generated. This option is not 
  501. normally used.
  502.  
  503. Unless file output is disabled (-F) POV-Ray will create an image file of 
  504. the picture. This output file describes each pixel with 24 bits of color 
  505. information. Currently, three output file formats are directly supported.  
  506. They are +FT - Uncompressed Targa-24 format (IBM-PC Default), +FD - Dump 
  507. format (QRT-style) and +FR - Raw format - one file each for Red, Green and 
  508. Blue. 
  509.  
  510.  
  511. 3.3.7 HEIGHT AND WIDTH OF IMAGE
  512.  
  513.       +Hnnn or -Hnnn    Set height of image in pixels
  514.       +Wnnn or -Wnnn    Set width of image in pixels
  515.  
  516. These switches set the height and width of the image in pixels.  This 
  517. specifies the image size for file output.  The preview display with the +D 
  518. option will generally attempt to pick a video mode to accommodate this size 
  519. but the +D settings do not in any way affect the resulting file output.
  520.  
  521.  
  522. 3.3.8 INPUT AND OUTPUT FILE NAMES
  523.  
  524.       +Ifilename  Set the input filename
  525.       +Ofilename  Set output filename
  526.  
  527. The default input filename is "object.pov". The default output filename is 
  528. "data" and the suffix for your default file type.  The +O switch has no 
  529. effect unless file output is turned on with +F
  530.  
  531. IBM-PC default file type is Targa, so the file is "data.tga".
  532.  
  533. Amiga uses dump format and the default outfile name is "data.dis".
  534.  
  535. Raw mode writes three files, "data.red", "data.grn" and "data.blu". On IBM-
  536. PC's, the default extensions for raw mode are ".r8", ".g8", and ".b8" to 
  537. conform to Piclab's "raw" format. Piclab is a widely used free-ware image 
  538. processing program. Normally, Targa files are used with Piclab, not raw 
  539. files.
  540.  
  541.  
  542. 3.3.10 ANIMATION CLOCK VARIABLE
  543.  
  544.       +Knnn or -Knnn    Set the "clock" float value
  545.  
  546. The +K switch may be used to pass a single float value to the program for 
  547. basic animation.  The value is stored in the float identifier "clock".  If 
  548. an object had a "rotate <0,clock,0>" attached then you could rotate the 
  549. object by different amounts over different frames by setting +K10, +K20... 
  550. etc. on successive renderings.
  551.  
  552.  
  553. 3.3.11 LIBRARY SEARCH PATH
  554.  
  555.       +Lpathspec  Specify on of 10 library search paths
  556.  
  557. The +L option may be used to specify a "library" pathname to look in for 
  558. include, parameter and image files. Multiple uses of the +L switch do not 
  559. override previous settings.  Up to ten +L options may be used to specify a 
  560. search path. The home (current) directory will be searched first followed 
  561. by the indicated library directories in order.
  562.  
  563.  
  564. 3.3.12 BOUNDING SLABS CONTROL
  565.  
  566.       -MB         Turn off bounding slabs
  567.       +MBnnn      Use bounding slabs if more than nnn objects in scene.
  568.  
  569. New in POV-Ray 2.0 is a spatial sub-division system called bounding slabs.  
  570. It compartmentalizes all of the objects in a scene into rectangular slabs 
  571. and computes which slabs a particular ray hits before testing the objects 
  572. within the slab.  This can greatly improve rendering speed.  However for 
  573. scenes with only a few objects the overhead of using slabs is not worth the 
  574. effort.  The +MB switch sets the minimum number of objects before slabs are 
  575. used.  The default is +MB25.  The -MB switch turns off slabs completely.
  576.  
  577.  
  578. 3.3.13 SYMBOL TABLE SIZE
  579.  
  580.       +MSnnn or -MSnnn        Sets symbol table size (default 1000)
  581.  
  582. POV-Ray allocates a fixed number of spaces in its symbol table for declared 
  583. identifiers.  The default of 1000 may be increased if you get a "Too many 
  584. symbols" error message.
  585.  
  586.  
  587. 3.3.14 VERSION COMPATIBILITY MODE
  588.  
  589.       +MVn.n or -MVn.n        Set version compatibility mode
  590.  
  591. While many language changes have been made for POV-Ray 2.0, most version 
  592. 1.0 syntax still works.  One new feature in 2.0 that is incompatible with 
  593. any 1.0 scene files is the parsing of float expressions.  Setting +MV1.0 
  594. turns off expression parsing as well as many warning messages so that 
  595. nearly all 1.0 files will still work.  The "#version" language directive 
  596. also can be used to change modes within scene files.  The +MV switch 
  597. affects only the initial setting.
  598.  
  599.  
  600. 3.3.15 PAUSE WHEN FINISHED
  601.  
  602.       +P          Pause when image is complete so preview image can
  603.                   be seen.
  604.       -P          Do not pause.  (default)
  605.  
  606. Normally when preview display is on you want to look at the image awhile 
  607. before continuing.  The +P switch pauses and waits for you to press a key 
  608. before going on.
  609.  
  610.  
  611. 3.3.16 QUALITY SETTINGS
  612.  
  613.       +Qn or -Qn  Set rendering quality
  614.  
  615. The +Q option allows you to specify the image rendering quality, for 
  616. quickly rendering images for testing. You may also use -Q with no 
  617. difference.  The parameter can range from 0 to 9. The values correspond to 
  618. the following quality levels:
  619.  
  620. 0,1  Just show quick colors. Ambient lighting only.
  621.      Quick colors are used only at 5 or below.
  622. 2,3  Show Diffuse and Ambient light
  623. 4,5  Render shadows, use extended lights at 5 but not 4
  624. 6,7  Create surface textures
  625. 8,9  Compute reflected, refracted, and transmitted rays.
  626.  
  627. The default is +Q9 (maximum quality) if not specified.
  628.  
  629.  
  630. 3.3.17 VERBOSE STATISTICS
  631.  
  632.       +V          Verbose statistics on
  633.       -V          Verbose statistics off
  634.  
  635. When the +D option is not used, it is often desirable to monitor progress 
  636. of the rendering.  The +V switch turns on verbose reporting while -V turns 
  637. it off.  The format of the output is system dependent.
  638.  
  639.  
  640. 3.3.18 ALLOW ABORTED RENDERING
  641.  
  642.       +X          Allow abort with keypress
  643.       -X          Disable abort with keypress
  644.  
  645. On the IBM-PC versions only, when you specify the +X switch then any 
  646. keypress will abort rendering.  The -X switch disables this feature.
  647.  
  648.  
  649. 3.4   DEFAULT PARAMETER FILE AND ENVIRONMENT VARIABLE
  650. -----------------------------------------------------
  651.  
  652. You may specify the default parameters by modifying the file "povray.def" 
  653. which contains the parameters in the above format. This filename contains a 
  654. complete command line as though you had typed it in, and is processed 
  655. before any options supplied on the command line are recognized. You may put 
  656. commands on more than one line in the "povray.def" file.
  657.  
  658. Examples:
  659.  
  660.   POVRAY +Ibox.pov +Obox.tga +V +X +W320 +H200 
  661.  
  662.      +Ibox.pov = Use the scene file box.pov for input
  663.      +Obox.tga = Output the image as a Targa file to box.tga 
  664.      +V = Show line numbers while rendering.
  665.      +X = Allow key press to abort render.
  666.      +W320 = Set image width to 320 pixels
  667.      +H200 = Set image height to 200 pixels
  668.  
  669. Some of these parameters could have been put in the POVRAYOPT environment 
  670. variable to save typing:
  671.  
  672.   SET POVRAYOPT = +V +X +W320 +H200
  673.  
  674. Then you could just type:
  675.  
  676.   POVRAY +Ibox.pov +Obox.tga 
  677.  
  678. Or, you could create a file called POVRAY.DEF in the same directory as the 
  679. scene file.  If POVRAY.DEF contains "+V +X +W320 +H200" then you could also 
  680. type:
  681.  
  682.   POVRAY +Ibox.pov +Obox.tga 
  683.  
  684. With the same results. You could also create an option file with a 
  685. different name and specify it on the command line:
  686.  
  687. For example, if QUICK.DEF contains "+V +X +W80 +H60" then you could also 
  688. type:
  689.  
  690.   POVRAY +Ibox.pov +Obox.tga QUICK.DEF
  691.  
  692. When POV-Ray sees QUICK.DEF, it will read it in just as if you typed it on 
  693. the command line.
  694.  
  695. The order that the options are read in for the IBM-PC version are as 
  696. follows:
  697.  
  698.   POVRAYOPT environment variable
  699.  
  700.   POVRAY.DEF in current directory or,
  701.              if not found, in library path
  702.  
  703.   Command line and command line option files
  704.  
  705. For example, +V in POVRAY.DEF would override -V in POVRAYOPT. +X on the 
  706. command line would override -X in POVRAY.DEF and so on.
  707.  
  708. Other computer's versions may read in the POVRAY.DEF file before the 
  709. POVRAYOPT environment variable.  See the documentation on your version.
  710.  
  711.  
  712. 4.0   BEGINNING TUTORIAL
  713. ========================
  714.  
  715. This section describes how to create a scene using POV-Ray's scene 
  716. description language and how to render this scene.
  717.  
  718.  
  719. 4.1   YOUR FIRST IMAGE
  720. ----------------------
  721.  
  722. Let's create the scene file for a simple picture. Since ray tracers thrive 
  723. on spheres, that's what we'll render first.
  724.  
  725.  
  726. 4.1.1 THE POV-Ray COORDINATE SYSTEM
  727.  
  728. First, we have to tell POV-Ray where our camera is and where it's looking. 
  729. To do this, we use 3D coordinates. The usual coordinate system for POV-Ray 
  730. has the positive Y axis pointing up, the positive X axis pointing to the 
  731. right, and the positive Z axis pointing into the screen as follows:
  732.  
  733.     ^+Y
  734.     |   /+Z
  735.     |  /
  736.     | /
  737.     |/        +X
  738.     |-------->
  739.  
  740.  
  741. The negative values of the axes point the other direction, as follows:
  742.  
  743.  
  744.           ^+Y
  745.           |   /+Z
  746.           |  /
  747.           | /
  748.   -X      |/        +X
  749.   <-------|-------->
  750.          /|
  751.         / |
  752.        /  |
  753.     -Z/   |
  754.           v-Y
  755.  
  756.  
  757. 4.1.2 ADDING STANDARD INCLUDE FILES
  758.  
  759. Using your personal favorite text editor, create a file called 
  760. "picture1.pov". Now, type in the following (note: The input is case 
  761. sensitive, so be sure to get capital and lowercase letters correct):
  762.  
  763.       #include "colors.inc"    // The include files contain
  764.       #include "shapes.inc"    // pre-defined scene elements
  765.       #include "textures.inc"
  766.  
  767.       camera {
  768.         location  <0, 2, -3>
  769.         look_at   <0, 1,  2>
  770.       }
  771.  
  772. The first include statement reads in definitions for various useful colors. 
  773. The second and third include statements read in some useful shapes and 
  774. textures respectively. When you get a chance, have a look through them to 
  775. see but a few of the many possible shapes and textures available.
  776.  
  777. You may have as many include files as needed in a scene file. Include files 
  778. may themselves contain include files, but you are limited to declaring 
  779. includes nested only 10 "deep".
  780.  
  781. Filenames specified in the include statements will be searched for in the 
  782. home (current) directory first, and if not found, will then be searched for 
  783. in directories specified by any "+L" (library path) options active. This 
  784. would facilitate keeping all your "include" (.inc) files such as 
  785. shapes.inc, colors.inc, and textures.inc in an "include" subdirectory, and 
  786. giving an "+L" option on the command line to where your library of include 
  787. files are.
  788.  
  789.  
  790. 4.1.3 PLACING THE CAMERA
  791.  
  792. The camera declaration describes where and how the camera sees the scene. 
  793. It gives X, Y, Z coordinates to indicate the position of the camera and 
  794. what part of the scene it is pointing at. You describe X, Y, Z coordinates 
  795. using a 3-part "vector".  A vector is specified by putting 3 numeric values 
  796. between a pair of angle brackets and separating the values with commas.
  797.  
  798. Briefly, "location <0, 2, -3>" places the camera up two units and back 
  799. three units from the center of the ray tracing universe which is at <0, 0, 
  800. 0>. Remember that by default +Z is into the screen and -Z is back out of 
  801. the screen.
  802.  
  803. Also "look_at <0, 1, 2>" rotates the camera to point at X, Y, Z coordinates 
  804. <0, 1, 2>.  A point 5 units in front of and 1 unit lower than the camera. 
  805. The look_at point should be the center of attention of your image.
  806.  
  807.  
  808. 4.1.4 DESCRIBING AN OBJECT
  809.  
  810. Now that the camera is set up to record the scene, let's place a red sphere 
  811. into the scene.  Type the following into your scene file:
  812.  
  813.       sphere {
  814.         <0, 1, 2>, 2
  815.         texture {
  816.           pigment {color Yellow}  // Yellow is pre-defined in COLORS.INC
  817.         }
  818.       }
  819.  
  820. The first vector specifies center of the sphere.  In this example the X 
  821. coordinate is zero so it is centered left and right.  It is also at Y=1 or 
  822. 1 unit up from the origin. The Z coordinate is 2 which is 5 units in front 
  823. of the camera at Z=-3. After the center vector is a comma followed by the 
  824. radius which in this case is 2 units. Since the radius is 1/2 the width of 
  825. a sphere, the sphere is 4 units wide. 
  826.  
  827.  
  828. 4.1.5 ADDING TEXTURE TO AN OBJECT
  829.  
  830. Now that we've defined the location and size of the sphere, we need to 
  831. describe the appearance of the surface.  The texture {...} block specifies 
  832. these parameters.  Texture blocks describe the color, bumpiness and finish 
  833. properties of an object.  In this example we will specify the color only.  
  834. This is the minimum we must do.  All other texture options except color 
  835. will use the default values.
  836.  
  837. The color you define is the way you want it to look if fully illuminated.  
  838. If you were painting a picture of a sphere you would use dark shades of a 
  839. color to indicate the shadowed side and bright shades on the illuminated 
  840. side.  However ray tracing takes care of that for you.  You pick the basic 
  841. color inherent in the object and POV-Ray brightens or darkens it depending 
  842. on the lighting in the scene.  Because we are defining the basic color the 
  843. object actually IS rather than how it LOOKS the parameter is called 
  844. "pigment".
  845.  
  846. Many types of color patterns are available for use in a pigment {...} 
  847. statement.  The keyword "color" specifies that the whole object is to be 
  848. one solid color rather than some pattern of colors.  The word "Yellow" is a 
  849. color identifier which was previously defined in the standard include file 
  850. "colors.inc".
  851.  
  852. If no standard color is available for your needs, you may define your own 
  853. color by using the color keyword followed by "red", "green" and "blue" 
  854. keywords specifying the amount of red, green and blue to be mixed.  For 
  855. example a nice shade of pink can be specified by:
  856.  
  857.       color red 1.0 green 0.8 blue 0.8
  858.  
  859. The values after each keyword should be in the range 0.0 to 1.0.  Any of 
  860. the three components not specified will default to 0.  A shortcut notation 
  861. may also be used.  The following produces the same shade of pink:
  862.  
  863.       color rgb <1.0, 0.8, 0.8>
  864.  
  865. Colors are explained in more detail later.
  866.  
  867.  
  868. 4.1.6 DEFINING A LIGHT SOURCE
  869.  
  870. One more detail is needed for our scene.  We need a light source. Until you 
  871. create one, there is no light in this virtual world.  Add the following 
  872. text to your scene file:
  873.  
  874.       light_source { <2, 4, -3> color White}
  875.  
  876. The vector specifies the location of the light as 2 units to our right, 4 
  877. units above the origin and 3 units back from the origin. The light_source 
  878. is invisible, it only casts light, so no texture is needed.
  879.  
  880. That's it!  Close the file and render a small picture of it using this 
  881. command:
  882.  
  883.       POVRAY +W160 +H120 +P +X +D0 -V -Ipicture1.pov
  884.  
  885. If your computer does not use the command line, see the executable docs for 
  886. the correct command to render a scene.
  887.  
  888. You may set any other command line options you like, also. The scene is 
  889. output to the image file DATA.TGA (or some suffix other than TGA if your 
  890. computer uses a different file format). You can convert DATA.TGA to a GIF 
  891. image using the commands listed in the docs included with your executable. 
  892.  
  893.  
  894. 4.2   MORE TEXTURE OPTIONS
  895. --------------------------
  896.  
  897. You've now rendered your first picture but it is somewhat boring.  Let's 
  898. add some fancy features to the texture.
  899.  
  900.  
  901. 4.2.1 SURFACE FINISHES
  902.  
  903. One of the main features of a ray tracer is its ability to do interesting 
  904. things with surface finishes such as highlights and reflection.  Let's add 
  905. a nice little phong highlight (shiny spot) to the sphere. To do this you 
  906. need a "finish" parameter. Change the definition of the sphere to this:
  907.  
  908.       sphere {
  909.         <0, 1, 2>, 2
  910.         texture {
  911.           pigment {color Yellow}  // Yellow is pre-defined in COLORS.INC
  912.           finish {phong 1}
  913.         }
  914.       }
  915.  
  916. Now render this the same way you did before. The phong keyword adds a 
  917. highlight the same color of the light shining on the object. It adds a lot 
  918. of credibility to the picture and makes the object look smooth and shiny. 
  919. Lower values of phong will make the highlight less bright. Phong can be 
  920. between 0 and 1.
  921.  
  922.  
  923. 4.2.2 ADDING BUMPINESS
  924.  
  925. The highlight you've added illustrates how much of our perception depends 
  926. on the reflective properties of an object.  Ray tracing can exploit this by 
  927. playing tricks on our perception to make us see complex details that aren't 
  928. really there.
  929.  
  930. Suppose you wanted a very bumpy surface on the object.  It would be very 
  931. difficult to mathematically model lots of bumps.  We can however simulate 
  932. the way bumps look by altering the way light reflects off of the surface.  
  933. Reflection calculations depend on a vector called a "surface normal" 
  934. vector.  This is a vector which points away from the surface and is 
  935. perpendicular to it.  By artificially modifying (or perturbing) this normal 
  936. vector you can simulate bumps.  Change the scene to read as follows and 
  937. render it:
  938.  
  939.       sphere {
  940.         <0, 1, 2>, 2
  941.         texture {
  942.           pigment {color Yellow}  
  943.           normal {bumps 0.4   scale 0.2}
  944.           finish {phong 1}
  945.         }
  946.       }
  947.  
  948. This tells POV-Ray to use a bump pattern to modify the surface normal.  The 
  949. value 0.4 controls the apparent depth of the bumps.  Usually the bumps are 
  950. about 1 unit wide which doesn't work very well with a sphere of radius 2.  
  951. The scale makes the bumps 1/5th as wide but does not affect their depth. 
  952.  
  953.  
  954. 4.2.3 CREATING COLOR PATTERNS
  955.  
  956. You can do more than assign a solid color to an object.  You can create 
  957. complex patterns in the pigment block.  Consider this example:
  958.  
  959.       sphere {
  960.         <0, 1, 2>, 2
  961.         texture {
  962.           pigment {
  963.             wood
  964.             color_map {
  965.               [0.0 color DarkTan]
  966.               [0.9 color DarkBrown]
  967.               [1.0 color VeryDarkBrown]
  968.             }
  969.             turbulence 0.05
  970.             scale <0.2, 0.3, 1>
  971.           }
  972.           finish {phong 1}
  973.         }
  974.       }
  975.  
  976. The keyword "wood" specifies a pigment pattern of concentric rings like 
  977. rings in wood.  The color_map specifies that the color of the wood should 
  978. blend from DarkTan to DarkBrown over the first 90% of the vein and from 
  979. DarkBrown to VeryDarkBrown over the remaining 10%.  The turbulence slightly 
  980. stirs up the pattern so the veins aren't perfect circles and the scale 
  981. factor adjusts the size of the pattern.
  982.  
  983. The most of the patterns are set up by default to give you one "feature" 
  984. across a sphere of radius 1.0. A "feature" is very roughly defined as a 
  985. color transition. For example, a wood texture would have one band on a 
  986. sphere of radius 1.0. In this example we scale the pattern using the 
  987. "scale" keyword followed by a vector.  In this case we scaled 0.2 in the x 
  988. direction, 0.3 in the y direction an the z direction is scaled by 1, which 
  989. leaves it unchanged. Scale values larger than 1 will stretch an element. 
  990. Scale values smaller than one will squish an element. And scale value 1 
  991. will leave an element unchanged.
  992.  
  993.  
  994. 4.2.4 PRE-DEFINED TEXTURES
  995.  
  996. POV-Ray has some very sophisticated textures pre-defined in the standard 
  997. include files "textures.inc" and "stones.inc".  Some are entire textures 
  998. with pigment, normal and/or finish parameters already defined.  Some are 
  999. just pigments or just finishes.   Change the definition of our sphere to 
  1000. the following and then re-render it: 
  1001.  
  1002.       sphere {
  1003.         <0, 1, 2>, 2
  1004.         texture {
  1005.           pigment {
  1006.             DMFWood4    // Pre-defined from textures.inc 
  1007.             scale 4     // Scale by the same amount in all
  1008.                         // directions
  1009.           }
  1010.           finish {Shiny}      // This finish defined in textures.inc
  1011.         }
  1012.       }
  1013.  
  1014. The pigment identifier DMFWood4 has already been scaled down quite small 
  1015. when it was defined.  For this example we want to scale the pattern larger.  
  1016. Because we want to scale it uniformly we can put a single value after the 
  1017. scale keyword rather than a vector of x,y,z scale factors.
  1018.  
  1019. Look through the file TEXTURES.INC to see what pigments and finishes are 
  1020. defined and try them out. Just insert the name of the new pigment where 
  1021. DMFWood1 is now or try a different finish in place of Shiny and re-render 
  1022. your file. 
  1023.  
  1024. Here is an example of using a complete texture identifier rather than just 
  1025. the pieces.
  1026.  
  1027.       sphere {
  1028.         <0, 1, 2>, 2
  1029.         texture { PinkAlabaster }
  1030.       }
  1031.  
  1032.  
  1033. 4.3   MORE SHAPES
  1034. -----------------
  1035.  
  1036. So far, we've just used the sphere shape. There are many other types of 
  1037. shapes that can be rendered by POV-Ray.  First let's make some room in the 
  1038. image by changing the sphere from a radius of 2 to a radius of 1 like this:
  1039.  
  1040.       sphere {
  1041.         <0, 1, 2>, 1 
  1042.         texture { ... and so on.
  1043.  
  1044.  
  1045. 4.3.1 PLANE OBJECT
  1046.  
  1047. Let's try out a computer graphics standard - "The Checkered Floor."  Add 
  1048. the following object to your .pov file:
  1049.  
  1050.       plane {
  1051.         <0, 1, 0>, 0 
  1052.         pigment {
  1053.           checker
  1054.             color Red
  1055.             color Blue
  1056.         }
  1057.       }
  1058.  
  1059. The object defined here is an infinite plane. The vector <0, 1, 0> is the 
  1060. surface normal of the plane (i.e., if you were standing on the surface, the 
  1061. normal points straight up.) The number afterward is the distance that the 
  1062. plane is displaced along the normal from the origin - in this case, the 
  1063. floor is placed at Y=0 so that the sphere at Y=1, radius= 1, is resting on 
  1064. it. 
  1065.  
  1066. Notice that there is no "texture{...}" statement.  There really is an 
  1067. implied texture there.  You might find that continually typing statements 
  1068. that are nested like "texture {pigment {...}}" can get to be a tiresome so 
  1069. POV-Ray lets you leave out the "texture{...}" under many circumstances.  In 
  1070. general you only need the texture block surrounding a texture identifier 
  1071. (like the PinkAlabaster example above), or when creating layered textures 
  1072. (which are covered later).  
  1073.  
  1074. This pigment uses the checker color pattern and specifies that the two 
  1075. colors red and blue should be used.
  1076.  
  1077. Because the vectors <1,0,0>, <0,1,0> and <0,0,1> are used frequently, POV-
  1078. Ray has 3 built-in vector identifiers "x", "y", and "z" respectively that 
  1079. can be used as shorthand.  Thus the plane could be defined as:
  1080.  
  1081.       plane { 
  1082.         y,0 
  1083.         pigment {... etc.
  1084.  
  1085. Note that you do not use angle brackets around vector identifiers.
  1086.  
  1087. Looking at the floor, you'll notice that the ball casts a shadow on the 
  1088. floor. Shadows are calculated very accurately by the ray tracer and creates 
  1089. precise, sharp shadows.  In the real world, penumbral or "soft" shadows are 
  1090. often seen. Later you'll learn how to use extended light sources to soften 
  1091. the shadows.
  1092.  
  1093.  
  1094. 4.3.2 BOX OBJECT
  1095.  
  1096. There are several other simple shapes available in POV-Ray.  The most 
  1097. common are the box, cylinder and cone.  Try these examples in place of the 
  1098. sphere:
  1099.  
  1100.       box {
  1101.         <-1,0  ,-1>,     // Near lower left corner
  1102.         < 1,0.5, 3>      // Far upper right corner
  1103.         pigment {
  1104.           DMFWood4      // Pre-defined from textures.inc 
  1105.           scale 4       // Scale by the same amount in all
  1106.                         // directions
  1107.         }
  1108.         rotate y*20     // Equivalent to "rotate <0,20,0>"
  1109.       }
  1110.  
  1111. In this example you can see that a box is defined by specifying the 3D 
  1112. coordinates of opposite corners.  The first vector must be the minimum 
  1113. x,y,z coordinates and the 2nd vector must be the maximum x,y,z values.  Box 
  1114. objects can only be defined parallel to the axes.  You can later rotate 
  1115. them to any angle.  Note that you can perform simple math on values and 
  1116. vectors.  In the rotate parameter we multiplied the vector identifier "y" 
  1117. by 20.  This is the same as "<0,1,0>*20" or "<0,20,0>".  
  1118.  
  1119.  
  1120. 4.3.3 CONE OBJECT
  1121.  
  1122. Here's another example:
  1123.  
  1124.       cone {
  1125.         <0,1,0>,0.3    // Center and radius of one end
  1126.         <1,2,3>,1.0    // Center and radius of other end
  1127.         pigment {DMFWood4  scale 4 }
  1128.         finish {Shiny}  
  1129.       }
  1130.  
  1131. The cone shape is defined by the center and radius of each end.  In this 
  1132. example one end is at location <0,1,0> and has radius of 0.3 while the 
  1133. other end is centered at <1,2,3> with radius 1.  If you want the cone to 
  1134. come to a sharp point then use a 0 radius.  The solid end caps are parallel 
  1135. to each other and perpendicular to the cone axis.  If you want a hollow 
  1136. cone with no end caps then add the keyword "open" after the 2nd radius like 
  1137. this:
  1138.  
  1139.       cone {
  1140.         <0,1,0>,0.3    // Center and radius of one end
  1141.         <1,2,3>,1.0    // Center and radius of other end
  1142.         open           // Removes end caps
  1143.         pigment {DMFWood4  scale 4 }
  1144.         finish {Shiny}  
  1145.       }
  1146.  
  1147.  
  1148. 4.3.4 CYLINDER OBJECT
  1149.  
  1150. You may also define a cylinder like this:
  1151.  
  1152.       cylinder {
  1153.         <0,1,0>,       // Center of one end
  1154.         <1,2,3>,       // Center of other end
  1155.         0.5            // Radius
  1156.         open           // Remove end caps
  1157.         pigment {DMFWood4  scale 4 }
  1158.         finish {Shiny}  
  1159.       }
  1160.  
  1161. Finally the standard include file "shapes.inc" contains some pre-defined 
  1162. shapes that are about the size of a sphere with a radius of one unit.  You 
  1163. can invoke them like this:
  1164.  
  1165.       object {
  1166.         UnitBox
  1167.         pigment {DMFWood4  scale 4 }
  1168.         finish {Shiny}  
  1169.         scale 0.75
  1170.         rotate <-20,25,0>
  1171.         translate y
  1172.       }
  1173.  
  1174. That's the end of our brief tutorial.  We've only scratched the surface.  
  1175. The rest of this document provides a reference to all of POV-Ray's 
  1176. features.
  1177.  
  1178.  
  1179. 5.0   SCENE DESCRIPTION LANGUAGE REFERENCE
  1180. ==========================================
  1181.  
  1182. The Scene Description Language allows the user to describe the world in a 
  1183. readable and convenient way.  Files are created in plain ASCII text using 
  1184. an editor of your choice.  POV-Ray reads the file, processes it by creating 
  1185. an internal model of the scene and the renders the scene.
  1186.  
  1187.  
  1188. 5.1   LANGUAGE BASICS
  1189. ---------------------
  1190.  
  1191. The POV-Ray language consists of identifiers, reserved keywords, floating 
  1192. point literals, string literals, special symbols and comments.  The text of 
  1193. a POV-Ray scene file is free format.  You may put statements on separate 
  1194. lines or on the same line as you desire.  You may add blank lines, spaces 
  1195. or indentations as long as you do not split any keywords or identifiers.
  1196.  
  1197.  
  1198. 5.1.1 IDENTIFIERS AND KEYWORDS
  1199.  
  1200. POV-Ray allows you to define identifiers for later use in the file.  An 
  1201. identifier may be 1 to 40 characters long.  It may consist of upper or 
  1202. lower case letters, the digits 0 through 9 or an underscore character.  The 
  1203. first character must be an alphabetic character.  The declaration of 
  1204. identifiers is covered later.
  1205.  
  1206. POV-Ray has a number of reserved words which are used in the language.  All 
  1207. reserved words are fully lower case.  Therefore it is recommended that your 
  1208. identifiers contain at least 1 upper case character so it is sure to avoid 
  1209. conflict with reserved words.
  1210.  
  1211. The following keywords are reserved in POV-Ray:
  1212.  
  1213. adaptive               height_field           rgbf                  
  1214. agate                  hexagon                right                 
  1215. agate_turb             iff                    ripples               
  1216. all                    image_map              rotate                
  1217. alpha                  include                roughness             
  1218. ambient                interpolate            scale                 
  1219. area_light             intersection           sky                   
  1220. background             inverse                smooth                
  1221. bicubic_patch          ior                    smooth_triangle       
  1222. blob                   jitter                 specular              
  1223. blue                   lambda                 sphere                
  1224. bounded_by             leopard                spotlight             
  1225. box                    light_source           spotted               
  1226. bozo                   location               sturm                 
  1227. brilliance             looks_like             texture               
  1228. bumps                  look_at                tga                   
  1229. bump_map               mandel                 threshold             
  1230. bump_size              map_type               tightness             
  1231. camera                 marble                 tile2                 
  1232. checker                material_map           tiles                 
  1233. clipped_by             max_intersections      torus                 
  1234. clock                  max_trace_level        translate             
  1235. color                  merge                  triangle              
  1236. color_map              metallic               turbulence            
  1237. colour                 normal                 type                  
  1238. colour_map             no_shadow              union                 
  1239. component              object                 up                    
  1240. composite              octaves                use_color             
  1241. cone                   omega                  use_colour            
  1242. crand                  once                   use_index             
  1243. cubic                  onion                  u_steps               
  1244. cylinder               open                   version               
  1245. declare                phase                  v_steps               
  1246. default                phong                  water_level           
  1247. dents                  phong_size             waves                 
  1248. difference             pigment                wood                  
  1249. diffuse                plane                  wrinkles              
  1250. direction              point_at               x                     
  1251. disc                   poly                   y                     
  1252. distance               pot                    z                     
  1253. dump                   quadric               
  1254. falloff                quartic               
  1255. filter                 quick_color           
  1256. finish                 quick_colour          
  1257. flatness               radial                
  1258. fog                    radius                
  1259. frequency              raw                   
  1260. gif                    red                   
  1261. gradient               reflection            
  1262. granite                refraction            
  1263. green                  rgb                   
  1264.                        
  1265.                        
  1266. 5.1.2 COMMENTS
  1267.  
  1268. Comments are text in the scene file included to make the scene file easier 
  1269. to read or understand. They are ignored by the ray tracer and are there for 
  1270. humans to read.  There are two types of comments in POV-Ray.
  1271.  
  1272. Two slashes are used for single line comments.  Anything on a line after a 
  1273. double slash // is ignored by the ray tracer.  For example:
  1274.  
  1275.   // This line is ignored
  1276.  
  1277. You can have scene file information on the line in front of the comment, as 
  1278. in:
  1279.  
  1280.   object { FooBar }  // this is an object
  1281.  
  1282. The other type of comment is used for multiple lines.  This type of comment 
  1283. starts with /* and ends with */ everything in-between is ignored.  For 
  1284. example:
  1285.  
  1286. /* These lines
  1287.     Are ignored 
  1288.     By the
  1289.     Raytracer */
  1290.  
  1291. This can be useful if you want to temporarily remove elements from a scene 
  1292. file.   /*...*/ comments can "comment out" lines containing the other // 
  1293. comments, and thus can be used to temporarily or permanently comment out 
  1294. parts of a scene.  /*..*/ comments can be nested, the following is legal:
  1295.  
  1296. /* This is a comment
  1297.     // This too
  1298.     /* This also */
  1299.  */
  1300.  
  1301. Use comments liberally and generously. Well used, they really improve the 
  1302. readability of scene files.
  1303.  
  1304.  
  1305. 5.1.3 INCLUDE FILES
  1306.  
  1307. The language allows include files to be specified by placing the line:
  1308.  
  1309.     #include "filename.inc"
  1310.  
  1311. at any point in the input file. The filename must be enclosed in double 
  1312. quotes and may be up to 40 characters long (or your computer's limit), 
  1313. including the two double-quote (") characters. 
  1314.  
  1315. The include file is read in as if it were inserted at that point in the 
  1316. file. Using include is the same as actually cutting and pasting the entire 
  1317. contents of this file into your scene. 
  1318.  
  1319. Include files may be nested. You may have at most 10 nested include files.  
  1320. There is no limit on un-nested include files.
  1321.  
  1322. Generally, include files have data for scenes, but are not scenes in 
  1323. themselves. By convention scene files end in .pov and include files end 
  1324. with .inc.
  1325.  
  1326.  
  1327. 5.1.4 FLOAT EXPRESSIONS
  1328.  
  1329. Many parts of the POV-Ray language require you to specify one or more 
  1330. floating point numbers.  A floating point number is a number with a decimal 
  1331. point.  Float literals are represented by an optional sign (-), some 
  1332. digits, an optional decimal point, and more digits.  If the number is an 
  1333. integer you may omit the decimal point and trailing zero.  If it is all 
  1334. fractional you may omit the leading zero.  POV-Ray supports scientific 
  1335. notation for very large or very small numbers.  The following are all valid 
  1336. float literals:
  1337.  
  1338.       1.0   -2.0  -4    34    3.4e6       2e-5        .3    0.6
  1339.  
  1340. Float identifiers may be declared and used anywhere a float can be used.  
  1341. See section 5.1.7 on declaring identifiers.  
  1342.  
  1343. Complex float expressions can be created using + - * / ( ) with float 
  1344. literals or identifiers.  Assuming the identifiers have been previously 
  1345. declared as floats, the following are valid float expressions:
  1346.  
  1347.       1+2+3       2*5         1/3         Row*3       Col*5
  1348.  
  1349.       (Offset-5)/2            This/That+Other*Thing
  1350.  
  1351. Expressions are evaluated left to right with innermost parenthesis 
  1352. evaluated first, then unary + or -, then multiply or divide, then add or 
  1353. subtract.
  1354.  
  1355. There are two built-in float identifiers.  The identifier "version" is the 
  1356. current setting of the version compatibility switch (See +MV under command-
  1357. line switches).  This allows you to save and restore the previous version 
  1358. switch.  For example suppose MYSTUFF.INC is in version 1.0 format.  At the 
  1359. top of the file you could put:
  1360.  
  1361.   #declare Temp_Vers = version    // Save previous value
  1362.   #version 1.0                    // Change to 1.0 mode
  1363.  
  1364.   ...   // Version 1.0 stuff goes here...
  1365.  
  1366.   #version Temp_Vers              // Restore previous version
  1367.  
  1368. The other float identifier is "clock".  Its value is set by the +K command-
  1369. line switch. (See +K under command-line switches).  This allows you to do 
  1370. limited animation control.  For example you could move an object using:
  1371.  
  1372.    translate <0.1*clock,0,0>
  1373.  
  1374. and render successive frames with +K1, +K2, +K3 etc.  In each frame the 
  1375. object would move 1/10th of a unit.
  1376.  
  1377.  
  1378. 5.1.5 VECTOR EXPRESSIONS
  1379.  
  1380. POV-Ray operates in a 3D x,y,z coordinate system.  Often you will need to 
  1381. specify x, y and z values.  A "vector" is a set of three float values used 
  1382. for such specification.  Vectors consist of three float expressions that 
  1383. are bracketed by angle brackets < and >.  The three terms are separated by 
  1384. commas.  For example:
  1385.  
  1386.      < 1.0, 3.2, -5.4578 >
  1387.  
  1388. The commas are necessary to keep the program from thinking that the 2nd 
  1389. term is "3.2-5.4578" and that there is no 3rd term.  If you see an error 
  1390. message "Float expected but '>' found instead" it probably means two floats 
  1391. were combined because a comma was missing.
  1392.  
  1393. The three values correspond to the x, y and z directions respectively. For 
  1394. example, the vector <1,2,3> means the point that's 1 unit to the right, 2 
  1395. units up, and 3 units in front the center of the "universe" at <0,0,0>. 
  1396. Vectors are not always points, though. They can also refer to an amount to 
  1397. size, move, or rotate a scene element.
  1398.  
  1399. Vectors may also be combined in expressions the same as float values.  For 
  1400. example <1,2,3>+<4,5,6> evaluates as <5,7,9>.  Subtraction, multiplication 
  1401. and division are also performed on a term-by-term basis.  You may also 
  1402. combine floats with vectors.  For example 5*<1,2,3> evaluates as <5,10,15>.
  1403.  
  1404. Sometimes POV-Ray requires you to specify floats and vectors side-by-side.  
  1405. Thus commas are required separators whenever an ambiguity might arise.  For 
  1406. example <1,2,3>-4 evaluates as <-3,-2,-1> but <1,2,3>,-4 is a vector 
  1407. followed by a float.
  1408.  
  1409. Vector identifiers may be declared and used anywhere a vector can be used.  
  1410. See section 5.1.7 on declaring identifiers.
  1411.  
  1412. Because vectors almost always refer to the x, y and z coordinates, POV-Ray 
  1413. has three built-in vector identifiers "x "y" and "z".  Like all POV-Ray 
  1414. keywords they must be lower case.  The vector identifier x is equivalent to 
  1415. the vector <1,0,0>.  Similarly y is <0,1,0> and z is <0,0,1>.
  1416.  
  1417. Thus an expression like 5*x evaluates to 5*<1,0,0> or <5,0,0>.  The use of 
  1418. these identifiers can make the scene file easier to read.
  1419.  
  1420.  
  1421. 5.1.6 TRANSFORMATIONS
  1422.  
  1423. Vectors are used not only as a notation for a point in space but are used 
  1424. in the transformations scale, rotate, and translate. Scale sizes a texture 
  1425. or object. Translate moves a texture or object. And rotate turns a texture 
  1426. or object.
  1427.  
  1428.  
  1429. 5.1.6.1     Translate
  1430.  
  1431. An object or texture pattern may be moved by adding a "translate" 
  1432. parameter.  It consists of the keyword "translate" followed by a vector.  
  1433. The terms of the vector specify the number of units to move in each of the 
  1434. x, y, and z directions.  Translate moves the element relative to it's 
  1435. current position. For example,
  1436.  
  1437.   sphere { <10, 10, 10>, 1 
  1438.     pigment { Green }
  1439.     translate <-5, 2, 1>
  1440.   }
  1441.  
  1442. Will move the sphere from <10, 10, 10> to <5, 12, 11>.  It does not move it 
  1443. to absolute location <5, 2, 1>. Translating by zero will leave the element 
  1444. unchanged on that axis. For example,
  1445.  
  1446.   sphere { <10, 10, 10>, 1 
  1447.     pigment { Green }
  1448.     translate <0, 0, 0>
  1449.   }
  1450.  
  1451. Will not move the sphere at all.
  1452.  
  1453.  
  1454. 5.1.6.2     Scale
  1455.  
  1456. You may change the size of an object or texture pattern by adding a "scale" 
  1457. parameter.  It consists of the keyword "scale" followed by a vector or a 
  1458. single float value.  If a vector is used, terms of the vector specify the 
  1459. amount of scaling in each of the x, y, and z directions.  If a float value 
  1460. is used, the item is uniformly scaled by the same amount in all directions.
  1461.  
  1462. Scale, is used to "stretch" or "squish" an element. Values larger than 1 
  1463. stretch the element on that axis. Values smaller than one are used to 
  1464. squish the element on that axis. Scale is relative to the current element 
  1465. size. If the element has been previously re-sized using scale, then scale 
  1466. will size relative to the new size. Multiple scale values may used.
  1467.  
  1468.  
  1469. 5.1.6.3     Rotate
  1470.  
  1471. You may change the orientation of an object or texture pattern by adding a 
  1472. "rotate" parameter.  It consists of the keyword "rotate" followed by a 
  1473. vector.  The three terms of the vector specify the number of degrees to 
  1474. rotate about each of the x, y, and z axes.  
  1475.  
  1476. Note that the order of the rotations does matter.  Rotations occur about 
  1477. the x axis first, then the y axis, then the z axis.  If you are not sure if 
  1478. this is what you want then you should use multiple rotation statements to 
  1479. get a correct rotation. You should only rotate on one axis at a time. As 
  1480. in,
  1481.  
  1482.    rotate <0, 30, 0>  // 30 degrees around Y axis then,
  1483.    rotate <-20, 0, 0> // -20 degrees around X axis then,
  1484.    rotate <0, 0, 10>  // 10 degrees around Z axis.
  1485.  
  1486. Rotation is always performed relative to the axis.  Thus if an object is 
  1487. some distance from the axis of rotation, its will not only rotate but it 
  1488. will "orbit" about the axis as though it was swinging around on an 
  1489. invisible string.  
  1490.  
  1491. To work out the rotation directions, you must perform the famous "Computer 
  1492. Graphics Aerobics" exercise. Hold up your left hand. Point your thumb in 
  1493. the positive direction of the axis of rotation. Your fingers will curl in 
  1494. the positive direction of rotation. Similarly if you point your thumb in 
  1495. the negative direction of the axis your fingers will curl in the negative 
  1496. direction of rotation.  This is the famous "left-hand coordinate system". 
  1497.  
  1498.                ^
  1499.              +Y|   +Z/ _
  1500.                |    /_| |_  _
  1501.                |   _| | | |/ \
  1502.                |  | | | | |  |
  1503.                | /| | | | |  V
  1504.      -X        |/ | | | | |    +X
  1505.     <----------+--|-|-|-|-|------>
  1506.               /|  |       \____
  1507.              / |  |         ___|
  1508.             /  |  \        /
  1509.            /   |   |      /
  1510.         -Z/  -Y|
  1511.          /     |
  1512.  
  1513. In this illustration, the left hand is curling around the X axis. The thumb 
  1514. points in the positive X direction and the fingers curl over in the 
  1515. positive rotation direction.
  1516.  
  1517. If you want to use a right hand system, as some CAD systems such as AutoCAD 
  1518. do, the "right" vector in the camera specification needs to be changed. See 
  1519. the detailed description of the camera.  In a right handed system you use 
  1520. your right hand for the "Aerobics". 
  1521.  
  1522.  
  1523. 5.1.6.4     Transforming Textures and Objects
  1524.  
  1525. When an object is transformed, all textures attached to the object AT THAT 
  1526. TIME are transformed as well. This means that if you have a translate, 
  1527. rotate, or scale in an object BEFORE a texture, the texture will not be 
  1528. transformed. If the scale, translate, or rotate is AFTER the texture then 
  1529. the texture will be transformed with the object.  If the transformation is 
  1530. INSIDE the "texture { }" statement then ONLY THE TEXTURE is affected.  The 
  1531. shape remains the same.  For example:
  1532.  
  1533.    sphere { <0, 0, 0>, 1
  1534.      texture { White_Marble }  // texture identifier from TEXTURES.INC
  1535.      scale 3                   // This scale affects both the 
  1536.                                // shape and texture 
  1537.    }
  1538.  
  1539.    sphere { <0, 0, 0>, 1
  1540.      scale 3             // This scale affects the shape only
  1541.      texture { White_Marble }  
  1542.    }
  1543.  
  1544.    sphere { <0, 0, 0>, 1
  1545.      texture { 
  1546.        White_Marble      
  1547.        scale 3           // This scale affects the texture only
  1548.      }  
  1549.    }
  1550.  
  1551. Transformations may also be independently applied to pigment patterns and 
  1552. surface normal (bump) patterns.  Note scaling a normal pattern affects only 
  1553. the width and spacing.  It does not affect the height or depth.  For 
  1554. example:
  1555.  
  1556.    box { <0, 0, 0>, <1, 1, 1>
  1557.      texture { 
  1558.        pigment {
  1559.          checker color Red color White
  1560.          scale 0.25  // This affects only the color pattern
  1561.        }
  1562.        normal {
  1563.          bumps 0.3   // This specifies apparent height of bumps
  1564.          scale 0.2   // Scales diameter and space between bumps but not 
  1565.                      //  not the height. Has no effect on color pattern.
  1566.        }
  1567.        rotate y*45   // This affects the entire texture but not
  1568.      }               //  the object. 
  1569.    }
  1570.  
  1571.  
  1572. 5.1.6.5     Transformation Order
  1573.  
  1574. Because rotations are always relative to the axis and scaling is relative 
  1575. to the origin, you will generally want to create an object at the origin 
  1576. and scale and rotate it first.  Then you may translate it into its proper 
  1577. position.  It is a common mistake to carefully position an object and then 
  1578. to decide to rotate it.  Because a rotation of an object causes it to orbit 
  1579. the axis, the position of the object may change so much that it orbits out 
  1580. of the field of view of the camera!
  1581.  
  1582. Similarly scaling after translation also moves an object unexpectedly. If 
  1583. you scale after you translate, the scale will multiply the translate 
  1584. amount. For example:
  1585.  
  1586.   translate <5, 6, 7>
  1587.   scale 4 
  1588.  
  1589. Will translate to 20, 24, 28 instead of 5, 6, 7. Be careful when 
  1590. transforming to get the order correct for your purposes.
  1591.  
  1592.  
  1593. 5.1.7 DECLARE
  1594.  
  1595. The parameters used to describe the scene elements can be tedious to use at 
  1596. times. Some parameters are often repeated and it seems wasteful to have to 
  1597. type them over and over again. To make this task easier, the program allows 
  1598. users to create identifiers as synonyms for a pre-defined set of parameters 
  1599. and use them anywhere the parameters would normally be used. For example, 
  1600. the color white is defined in the POV-Ray language as:
  1601.  
  1602.    color red 1 green 1 blue 1
  1603.  
  1604. This can be pre-defined in the scene as:
  1605.  
  1606.    #declare White = color red 1 green 1 blue 1
  1607.  
  1608. and then substituted for the full description in the scene file, for 
  1609. example:
  1610.  
  1611.    sphere { 
  1612.      <0, 0, 0>, 1
  1613.      pigment { color red 1 green 1 blue 1 }
  1614.    }
  1615.  
  1616. becomes:
  1617.  
  1618.    #declare White = color red 1 green 1 blue 1
  1619.  
  1620.    sphere { 
  1621.      <0, 0, 0>, 1
  1622.      pigment { color White }
  1623.    }
  1624.  
  1625. This is much easier to type and to read. The pre-defined element may be 
  1626. used many times in a scene.
  1627.  
  1628. You use the keyword "declare" to pre-define a scene element and give it a 
  1629. one-word identifier. This pre-defined scene element is not used in the 
  1630. scene until you invoke its identifier. Textures, objects, colors, numbers 
  1631. and more can be predefined.
  1632.  
  1633. In most cases when you invoke an identifier you simply use the form 
  1634. "keyword{identifier}" where the keyword used is the type of statement that 
  1635. was declared. For example:
  1636.  
  1637.   #declare Shiny = finish {phong 0.8 phong_size 50 reflection 0.2}
  1638.  
  1639.   sphere {
  1640.      <0, 0, 0>, 1
  1641.      pigment { color White }
  1642.      finish { Shiny }
  1643.    }
  1644.  
  1645. The identifier "Shiny" was declared as a "finish" and is invoked by placing 
  1646. it inside a "finish { }" statement.
  1647.  
  1648. One exception is object identifiers.  If you declare any object of any kind 
  1649. such as sphere, box, union, intersection etc. you should invoke it by 
  1650. placing it in an "object { }" statement.  Thus you might have:
  1651.  
  1652.   #declare Thing = intersection {...}
  1653.  
  1654.   object {Thing}  // not "intersection{Thing}"
  1655.  
  1656. Pre-defined elements may be modified when they are used, for example:
  1657.  
  1658.   #declare Mickey = // Pre-define a union object called Mickey
  1659.      union {
  1660.        sphere { < 0, 0, 0>, 2 }
  1661.        sphere { <-2, 2, 0>, 1 }
  1662.        sphere { < 2, 2, 0>, 1 }
  1663.      }
  1664.  
  1665.   // Use Mickey
  1666.      object{        // Note use of "object", not "union" keyword
  1667.        Mickey
  1668.        scale 3
  1669.        rotate y*20
  1670.        translate <0, 8, 10>
  1671.        pigment {color red 1}
  1672.        finish {phong .7}
  1673.      }
  1674.  
  1675. This scene will only have one "Mickey", the Mickey that is described 
  1676. doesn't appear in the scene. Notice that Mickey is scaled, rotated, 
  1677. translated, and a texture is added to it. The Mickey identifier could be 
  1678. used many times in a scene file, and each could have a different size, 
  1679. position, orientation, and texture.
  1680.  
  1681. Declare is especially powerful when used to create a complex object. Each 
  1682. part of the object is defined separately using declare. These parts can be 
  1683. tested, rotated, sized, positioned, and textured separately then combined 
  1684. in one shape or object for the final sizing, positioning, etc. For example, 
  1685. you could define all the parts of a car like this:
  1686.  
  1687.   #declare Wheel = object {...}
  1688.   #declare Seat = object {...}
  1689.   #declare Body = object {...}
  1690.   #declare Engine = object {...}
  1691.   #declare Steering_Wheel = object {...}
  1692.  
  1693.   #declare Car = 
  1694.     union {
  1695.        object { Wheel translate < 1, 1, 2>}
  1696.        object { Wheel translate <-1, 1, 2>}
  1697.        object { Wheel translate < 1, 1,-2>}
  1698.        object { Wheel translate <-1, 1,-2>}
  1699.        object { Seat translate < .5, 1.4, 1>}
  1700.        object { Seat translate <-.5, 1.4, 1>}
  1701.        object { Steering_Wheel translate <-.5, 1.6, 1.3>}
  1702.        object { Body texture { Brushed_Steel } }
  1703.        object { Engine translate <0, 1.5, 1.5> 
  1704.     }
  1705.  
  1706. and then it like this:
  1707.  
  1708.   // Here is a car
  1709.   object {
  1710.     Car 
  1711.     translate <4, 0, 23>
  1712.   }
  1713.  
  1714. Notice that the Wheel and Seat are used more than once. A declared element 
  1715. can be used as many times as you need. Declared elements may be placed in 
  1716. "include" files so they can be used with more than one scene.
  1717.  
  1718. There are several files included with POV-Ray that use declare to pre-
  1719. define many shapes, colors, and textures. See the archive INCLUDE for more 
  1720. info.
  1721.  
  1722. NOTE: Declare is not the same as the C language's define. Declare creates 
  1723. an internal object of the type specified that POV-Ray can copy for later 
  1724. use.  The "define" used in C creates a text substitution macro.
  1725.  
  1726. Here's a list of what can be declared, how to declare the element, and how 
  1727. to use the declaration. See the reference section for element syntax.
  1728.  
  1729. Objects: (Any type may be declared, sphere, box, height_field, blob, etc.)
  1730.   #declare Tree = union {...}
  1731.   #declare Ball = sphere {...}
  1732.   #declare Crate= box {...}
  1733.  
  1734.   object {
  1735.     Tree
  1736.     (OBJECT_MODIFIERS...) 
  1737.   }
  1738.  
  1739.   object {
  1740.     Ball
  1741.     (OBJECT_MODIFIERS...) 
  1742.   }
  1743.  
  1744.   object {
  1745.     Crate
  1746.     (OBJECT_MODIFIERS...) 
  1747.   }
  1748.  
  1749. Textures:
  1750.   #declare Fred = texture {...} 
  1751.  
  1752.   sphere { <0, 0, 0>, 1 
  1753.     texture {
  1754.       Fred 
  1755.       (texture_modifiers) 
  1756.     }
  1757.   }
  1758.  
  1759. Layered textures:
  1760.   #declare Fred = 
  1761.      texture {...} 
  1762.      texture {...} 
  1763.      texture {...} (etc.)
  1764.  
  1765.   sphere { <0, 0, 0>, 1 
  1766.     texture {
  1767.       Fred 
  1768.       (texture_modifiers) 
  1769.     }
  1770.   }
  1771.  
  1772. Pigment:
  1773.   #declare Fred = pigment {checker color Red color White} 
  1774.  
  1775.   sphere { <0, 0, 0>, 1 
  1776.     pigment {
  1777.       Fred 
  1778.       (pigment_modifiers) 
  1779.     }
  1780.   }
  1781.  
  1782. Normal:
  1783.   #declare Fred = normal {bumps 0.5} 
  1784.  
  1785.   sphere { <0, 0, 0>, 1 
  1786.     pigment {White}
  1787.     normal {
  1788.       Fred 
  1789.       (normal_modifiers) 
  1790.     }
  1791.   }
  1792.  
  1793. Finish:
  1794.   #declare Fred = finish {phong 0.7 reflection 0.2} 
  1795.  
  1796.   sphere { <0, 0, 0>, 1 
  1797.     pigment {White}
  1798.     finish {
  1799.       Fred 
  1800.       (finish_items) 
  1801.     }
  1802.   }
  1803.  
  1804. Colors:
  1805.   #declare Fred = color red 1 green 1 blue 1 
  1806.  
  1807.   sphere { <0, 0, 0>, 1 
  1808.     pigment { color Fred }
  1809.   }
  1810.  
  1811. Color_map:
  1812.   #declare Rainbow = 
  1813.     color_map {
  1814.       [0.0 color Cyan]
  1815.       [1/3 color Yellow]
  1816.       [2/3 color Magenta]
  1817.       [1.0 color Cyan]
  1818.     }
  1819.  
  1820.   sphere { <0, 0, 0>, 1 
  1821.     pigment { radial color_map{Rainbow} rotate -90*x}
  1822.   }
  1823.  
  1824. Float Values:
  1825.   #declare Fred  = 3.45
  1826.   #declare Fred2 = .02
  1827.   #declare Fred3 = .5
  1828.  
  1829.  // Use the numeric value identifier 
  1830.  // anywhere a number would go
  1831.   sphere { <-Fred, 2, Fred>, Fred 
  1832.     pigment { color red 1 }
  1833.     finish { phong Fred3 }
  1834.   }
  1835.  
  1836. Camera:
  1837.   #declare Fred = camera {..}
  1838.  
  1839.   camera { Fred }
  1840.  
  1841. Vectors:
  1842.    #declare Fred = <9, 3, 2>
  1843.    #declare Fred2 = <4, 1, 4>
  1844.  
  1845.    sphere { Fred, 1  // Note do not put < > brackets
  1846.      scale Fred2     // around vector identifiers
  1847.    }
  1848.  
  1849.  
  1850. 5.2   OBJECTS
  1851. -------------
  1852.  
  1853. Objects are the building blocks of your scene.  There are 20 different 
  1854. types of objects supported by POV-Ray.  Seven of them are finite solid 
  1855. primitives, 4 are finite patch primitives, 5 are infinite solid polynomial 
  1856. primitives, 3 are types of Constructive Solid Geometry types and one is a 
  1857. specialized object that is a light source.
  1858.  
  1859. The basic syntax of an object is a keyword describing its type, some 
  1860. floats, vectors or other parameters which further define its location 
  1861. and/or shape and some optional object modifiers such as texture, pigment, 
  1862. normal, finish, bounding, clipping or transformations.
  1863.  
  1864. The texture describes what the object looks like, ie. its material.  
  1865. Textures are combinations of pigments, normals and finishes.  Pigment is 
  1866. the color or pattern of colors inherent in the material.  Normal is a 
  1867. method of simulating various patterns of bumps, dents, ripples or waves by 
  1868. modifying the surface normal vector.  Finish describes the reflective and 
  1869. refractive properties of a material.
  1870.  
  1871. Bounding shapes are finite, invisible shapes which wrap around complex, 
  1872. slow rendering shapes in order to speed up rendering time.  Clipping shapes 
  1873. are used to cut away parts of shapes to expose a hollow interior.  
  1874. Transformations tell the ray tracer how to move, size or rotate the shape 
  1875. and/or the texture in the scene.
  1876.  
  1877.  
  1878. 5.2.1 SOLID FINITE PRIMITIVES
  1879.  
  1880. There are 7 different solid finite primitive shapes: blob, box, cone, 
  1881. cylinder, height_field, sphere, and torus. These have a well-defined 
  1882. "inside" and can be used in Constructive Solid Geometry. Because these 
  1883. types are finite, POV-Ray can use automatic bounding on them to speed up 
  1884. rendering time.  
  1885.  
  1886.  
  1887. 5.2.1.1     Spheres
  1888.  
  1889. Since spheres are so common in ray traced graphics, POV-Ray has a highly 
  1890. optimized sphere primitive which renders much more quickly than the 
  1891. corresponding polynomial quadric shape. The syntax is:
  1892.  
  1893.      sphere { <CENTER>, RADIUS }
  1894.  
  1895. Where <CENTER> is a vector specifying the x,y,z coordinates of the center 
  1896. of the sphere and RADIUS is a float value specifying the radius.  You can 
  1897. also add translations, rotations, and scaling to the sphere. For example, 
  1898. the following two objects are identical:
  1899.  
  1900.   sphere { <0, 25, 0>, 10
  1901.     pigment {Blue}
  1902.   }
  1903.  
  1904.   sphere { <0, 0, 0>, 1.0
  1905.     pigment {Blue}
  1906.     scale 10
  1907.     translate y*25
  1908.   }
  1909.  
  1910. Note that Spheres may be scaled unevenly giving an ellipsoid shape. 
  1911.  
  1912. Because spheres are highly optimized they make good bounding shapes. 
  1913. Because they are finite they respond to automatic bounding. As with all 
  1914. shapes, they can be translated, rotated and scaled.
  1915.  
  1916.  
  1917. 5.2.1.2     Boxes
  1918.  
  1919. A simple box can be defined by listing two corners of the box like this:
  1920.  
  1921.   box { <CORNER1>, <CORNER2> }
  1922.  
  1923. Where <CORNER1> and <CORNER2> are vectors defining the x,y,z coordinates of 
  1924. opposite corners of the box.  For example:
  1925.  
  1926.   box { <0, 0, 0>, <1, 1, 1> }
  1927.  
  1928. Note that all boxes are defined with their faces parallel to the coordinate 
  1929. axes.  They may later be rotated to any orientation using a rotate 
  1930. parameter.
  1931.  
  1932. Each element of CORNER1 should always be less than the corresponding 
  1933. element in CORNER2. If any elements of CORNER1 are larger than CORNER2, the 
  1934. box will not appear in the scene.
  1935.  
  1936. Boxes are calculated efficiently and make good bounding shapes. Because 
  1937. they are finite they respond to automatic bounding. As with all 
  1938. shapes, they can be translated, rotated and scaled.
  1939.  
  1940.  
  1941. 5.2.1.3     Cylinders
  1942.  
  1943. A finite length cylinder with parallel end caps may be defined by.
  1944.  
  1945.    cylinder { <END1>, <END2>, RADIUS }
  1946.  
  1947. Where <END1> and <END2> are vectors defining the x,y,z coordinates of the 
  1948. center of each end of the cylinder and RADIUS is a float value for the 
  1949. radius.  For example:
  1950.  
  1951.    cylinder { <0,0,0>, <3,0,0>, 2}
  1952.  
  1953. is a cylinder 3 units long lying along the x axis from the origin to x=3 
  1954. with a radius of 2.
  1955.  
  1956. Normally the ends of a cylinder are closed by flat planes which are 
  1957. parallel to each other and perpendicular to the length of the cylinder.  
  1958. Adding the optional keyword "open" after the radius will remove the end 
  1959. caps and results in a hollow tube.
  1960.  
  1961. Because they are finite they respond to automatic bounding. As with all 
  1962. shapes, they can be translated, rotated and scaled.
  1963.  
  1964.  
  1965. 5.2.1.4     Cones
  1966.  
  1967. A finite length cone or a frustum (a cone with the point cut off) may be 
  1968. defined by.
  1969.  
  1970.    cone { <END1>, RADIUS1, <END2>, RADIUS2 }
  1971.  
  1972. Where <END1> and <END2> are vectors defining the x,y,z coordinates of the 
  1973. center of each end of the cone and RADIUS1 and RADIUS2 are float values for 
  1974. the radius of those ends.  For example:
  1975.  
  1976.    cone { <0,0,0>,2 <0,3,0>, 0}
  1977.  
  1978. is a cone 3 units tall pointing up the y axis from the origin to y=3.  The 
  1979. base has a radius of 2.  The other end has a radius of 0 which means it 
  1980. comes to a sharp point.  If neither radius is zero then the results look 
  1981. like a tapered cylinder or a cone with the point cut off.
  1982.  
  1983. Like a cylinder, normally the ends of a cone are closed by flat planes 
  1984. which are parallel to each other and perpendicular to the length of the 
  1985. cone.  Adding the optional keyword "open" after RADIUS2 will remove the end 
  1986. caps and results in a tapered hollow tube like a megaphone or funnel.
  1987.  
  1988. Because they are finite they respond to automatic bounding. As with all 
  1989. shapes, they can be translated, rotated and scaled.
  1990.  
  1991.  
  1992. 5.2.1.5     Torus
  1993.  
  1994. A torus is a 4th order quartic polynomial shape that looks like a donut or 
  1995. inner tube.  Because this shape is so useful and quartics are difficult to 
  1996. define, POV-Ray lets you take a short-cut and define a torus by:
  1997.  
  1998.    torus { MAJOR, MINOR }
  1999.  
  2000. where MAJOR is a float value giving the major radius and MINOR is a float 
  2001. specifying the minor radius.  The major radius extends from the center of 
  2002. the hole to the mid-line of the rim while the minor radius is the radius of 
  2003. the cross-section of the rim.  The torus is centered at the origin and lies 
  2004. in the X-Z plane with the Y-axis sticking through the hole.
  2005.  
  2006.         ----------- - - - - - - - ----------              +Y       
  2007.        /          \              /          \              |       
  2008.       /            \            /            \             |       
  2009.      |              |          |       |<-B-->|       -X---|---+X  
  2010.       \            /            \            /             |       
  2011.        \__________/_ _ _ _ _ _ _ \__________/              |       
  2012.                          |<-----A----->|                  -Y       
  2013.  
  2014.       A = Major Radius
  2015.       B = Minor Radius
  2016.  
  2017. Internally the torus is computed the same as any other quartic or 4th order 
  2018. polynomial however a torus defined this way will respond to automatic 
  2019. bounding while a quartic must be manually bound if at all.  As with all 
  2020. shapes, a torus can be translated, rotated and scaled.  Calculations for 
  2021. all higher order polynomials must be very accurate.  If this shape renders 
  2022. improperly you may add the keyword "sturm" after the MINOR value to use 
  2023. POV-Ray's slower-yet-more-accurate Sturmian root solver.
  2024.  
  2025.  
  2026. 5.2.1.6     Blob
  2027.  
  2028. Blobs are an interesting shape type. Their components are "flexible" 
  2029. spheres that attract or repel each other creating a "blobby" organic 
  2030. looking shape. The spheres' surfaces actually stretch out smoothly and 
  2031. connect, as if coated in silly putty (honey? glop?) and pulled apart.
  2032.  
  2033. Picture each blob component as a point floating in space.  Each point has a 
  2034. field around it that starts very strong at the center point and drops off 
  2035. to zero at some radius. POV-Ray adds together the field strength of each 
  2036. component and looks for the places that the strength of the field is 
  2037. exactly the same as the "threshold" value that was specified.  Points with 
  2038. a total field strength greater than the threshold are considered inside the 
  2039. blob.  Those less than the threshold are outside.  Points equal to the 
  2040. threshold are on the surface of the blob.
  2041.  
  2042. A blob is defined as follows:
  2043.  
  2044.   blob {
  2045.      threshold THRESHOLD_VALUE
  2046.      component STRENGTH, RADIUS, <CENTER>
  2047.      component STRENGTH, RADIUS, <CENTER>  // Repeat for any number  
  2048.      component STRENGTH, RADIUS, <CENTER>  //  of components         
  2049.   }
  2050.  
  2051. The keyword "threshold" is followed by a float THRESHOLD_VALUE.  Each 
  2052. component begins with the keyword "component".  STRENGTH is a float value 
  2053. specifying the field strength at its center.  The strength may be positive 
  2054. or negative. A positive value will make that component attract other 
  2055. components. Negative strength will make that component repel other 
  2056. components. Components in different, separate blob shapes do not affect 
  2057. each other.  The strength tapers off to zero at the value specified by the 
  2058. float RADIUS.  The vector <CENTER> specifies the x,y,z coordinates of the 
  2059. component. For example:
  2060.  
  2061.   blob {
  2062.     threshold 0.6
  2063.     component 1.0, 1.0, <.75, 0, 0>
  2064.     component 1.0, 1.0, <-.375, .64952, 0>
  2065.     component 1.0, 1.0, <-.375, -.64952, 0>
  2066.     scale 2 
  2067.   }
  2068.  
  2069. If you have a single blob component then the surface you see will look just 
  2070. like a sphere, with the radius of the surface being somewhere inside the 
  2071. "radius" value you specified for the component. The exact radius of this 
  2072. sphere-like surface can be determined from the blob equation listed below 
  2073. (you will probably never need to know this, blobs are more for visual 
  2074. appeal than for exact modeling).
  2075.  
  2076. If you have a number of blob components, then their fields add together at 
  2077. every point in space - this means that if the blob components are close 
  2078. together the resulting surface will smoothly flow around the components.
  2079.  
  2080. The various numbers that you specify in the blob declaration interact in 
  2081. several ways.  The meaning of each can be roughly stated as:
  2082.  
  2083. THRESHOLD:
  2084.      This is the total density value that POV-Ray is looking for. By 
  2085. following the ray out into space and looking at how each blob component 
  2086. affects the ray, POV-Ray will find the points in space where the density is 
  2087. equal to the "threshold" value.
  2088.  
  2089.      1) "threshold" must be greater than 0. POV-Ray only looks for positive 
  2090. densities.
  2091.      2) If "threshold" is greater than the strength of a component, then 
  2092. the component will disappear.
  2093.      3) As "threshold" gets larger the surface you see gets closer to the 
  2094. centers of the components.
  2095.      4) As "threshold" gets smaller, the surface you see gets closer to the 
  2096. spheres at a distance of "radius" from the centers of the components.
  2097.  
  2098. STRENGTH:
  2099.      Each component has a strength value - this defines the density of the 
  2100. component at the center of the component. Changing this value will usually 
  2101. have only a subtle effect.
  2102.  
  2103.      1) "strength" may be positive or negative. Zero is a bad value, as the 
  2104. net result is that no density was added - you might just as well have not 
  2105. used this component.
  2106.      2) If "strength" is positive, then POV-Ray will add its density to the 
  2107. space around the center of the component. If this adds enough density to be 
  2108. greater than "threshold you will see a surface.
  2109.      3) If "strength" is negative, then POV-Ray will subtract its density 
  2110. from the space around the center of the component. This will only do 
  2111. something if there happen to be positive components nearby. What happens is 
  2112. that the surface around any nearby positive components will be dented away 
  2113. from the center of the negative component.
  2114.  
  2115. RADIUS: 
  2116.      Each component has a radius of influence. The component can only 
  2117. affect space within "radius" of its center. This means that if all of the 
  2118. components are farther than "radius" from each other, you will only see a 
  2119. bunch of spheres.  If a component is within the radius of another 
  2120. component, then the two components start to affect each other. At first 
  2121. there is only a small bulge outwards on each of the two components, as they 
  2122. get closer they bulge more and more until they attach along a smooth neck.  
  2123. If the components are very close (i.e. their centers are on top of each 
  2124. other), then you will only see a sphere (this is just like having a 
  2125. component of more strength. bigger than the size of each of the component 
  2126. radii)
  2127.      1) "radius" must be bigger than 0.
  2128.      2) As "radius" increases the apparent size of the component will 
  2129. increase.
  2130.  
  2131. CENTER:
  2132.      This is simply a point in space.  It defines the center of a blob 
  2133. component.  By changing the x/y/z values of the center you move the 
  2134. component around.
  2135.  
  2136. THE FORMULA
  2137.      For the more mathematically minded, here's the formula used internally 
  2138. by POV-Ray to create blobs. You don't need to understand this to use blobs. 
  2139.  
  2140. The formula used for a single blob component is:
  2141.  
  2142.       density = strength * (1 - radius^2)^2
  2143.  
  2144. This formula has the nice property that it is exactly equal to strength" at 
  2145. the center of the component and drops off to exactly 0 at a distance of 
  2146. "radius" from the center of the component. The density formula for more 
  2147. than one blob component is just the sum of the individual component 
  2148. densities:
  2149.  
  2150.       density = density1 + density2 + ...
  2151.  
  2152. Blobs can be used in CSG shapes and they can be scaled, rotated and 
  2153. translated. Because they are finite they respond to automatic bounding.  
  2154. The calculations for blobs must be very accurate.  If this shape renders 
  2155. improperly you may add the keyword "sturm" after the last component to use 
  2156. POV-Ray's slower-yet-more-accurate Sturmian root solver.
  2157.  
  2158.  
  2159. 5.2.1.7     Height Fields
  2160.  
  2161. Height fields are fast, efficient objects that are generally used to create 
  2162. mountains or other raised surfaces out of hundreds of triangles in a mesh.  
  2163.  
  2164. A height field is essentially a 1 unit wide by 1 unit long box with a 
  2165. mountainous surface on top.  The height of the mountain at each point is 
  2166. taken from the color number (palette index) of the pixels in a graphic 
  2167. image file. 
  2168.  
  2169.  
  2170.                     ________  <---- image index 255
  2171.                   /        /|
  2172.             +1y  ---------- |
  2173.                  |        | |
  2174.                  |        | |+1z <- Image upper-right
  2175.                  |        | /
  2176.             0,0,0---------- +1x
  2177.                  ^
  2178.                  |____ Image lower-left
  2179.  
  2180.  
  2181.     NOTE: Image resolution is irrelevant to the scale of the heightfield.
  2182.  
  2183. The mesh of triangles corresponds directly to the pixels in the image file. 
  2184. In fact, there are two small triangles for every pixel in the image file. 
  2185. The Y (height) component of the triangles is determined by the palette 
  2186. index number stored at each location in the image file. The higher the 
  2187. number, the higher the triangle. The maximum height of an un-scaled height 
  2188. field is 1 unit.
  2189.  
  2190. The higher the resolution of the image file used to create the height 
  2191. field, the smoother the height field will look. A 640 X 480 GIF will create 
  2192. a smoother height field than a 320 x 200 GIF.  The size/resolution of the 
  2193. image does not affect the size of the height field. The un-scaled height 
  2194. field size will always be 1x1. Higher resolution image files will create 
  2195. smaller triangles, not larger height fields.
  2196.  
  2197. There are three types files which can define a height field as follows:
  2198.  
  2199.    height_field { gif "filename.gif" }
  2200.    height_field { tga "filename.tga" }
  2201.    height_field { pot "filename.pot" }
  2202.  
  2203. The image file used to create a height field can be a GIF, TGA or POT 
  2204. format file. The GIF format is the only one that can be created using a 
  2205. standard paint program.
  2206.  
  2207. In a GIF file, the color number is the palette index at a given point. Use 
  2208. a paint program to look at the palette of a GIF image. The first color is 
  2209. palette index zero, the second is index 1, the third is index 2, and so on. 
  2210. The last palette entry is index 255. Portions of the image that use low 
  2211. palette entries will be lower on the height field.  Portions of the image 
  2212. that use higher palette entries will be higher on the height field. For 
  2213. example, an image that was completely made up of entry 0 would be a flat 
  2214. 1x1 square. An image that was completely made up of entry 255 would be a 
  2215. 1x1x1 cube.
  2216.  
  2217. The maximum number of colors in a GIF are 256, so a GIF height field can 
  2218. have any number of triangles, but they will only 256 different height 
  2219. values. 
  2220.  
  2221. The color of the palette entry does not affect the height of the pixel. 
  2222. Color entry 0 could be red, blue, black, or orange, but the height of any 
  2223. pixel that uses color entry 0 will always be 0. Color entry 255 could be 
  2224. indigo, hot pink, white, or sky blue, but the height of any pixel that uses 
  2225. color entry 255 will always be 1.
  2226.  
  2227. You can create height field GIF images with a paint program or a fractal 
  2228. program like "Fractint".  If you have access to an IBM-PC, you can get 
  2229. Fractint from most of the same sources as POV-Ray.
  2230.  
  2231. A POT file is essentially a GIF file with a 16 bit palette. The maximum 
  2232. number of colors in a POT file is greater than 32,000. This means a POT 
  2233. height field can have over 32,000 possible height values. This makes it 
  2234. possible to have much smoother height fields. Note that the maximum height 
  2235. of the field is still 1 even though more intermediate values are possible.
  2236.  
  2237. At the time of this writing, the only program that created POT files was a 
  2238. freeware IBM-PC program called Fractint. POT files generated with this 
  2239. fractal program create fantastic landscapes. If you have access to an IBM-
  2240. PC, you can get Fractint from most of the same sources as POV-Ray.
  2241.  
  2242. The TGA file format may be used as a storage device for 16 bit numbers 
  2243. rather than an image file. The TGA format uses the red and green bytes of 
  2244. each pixel to store the high and low bytes of a height value. TGA files are 
  2245. as smooth as POT files, but they must be generated with special custom-made 
  2246. programs. Currently, this format is of most use to programmers, though you 
  2247. may see TGA height field generator programs arriving soon.  There is 
  2248. example C source code included with the POV-Ray source archive to create a 
  2249. TGA file for use with a height field.  
  2250.  
  2251. It is nearly impossible to take advantage of the 16 bits of resolution 
  2252. offered by the use of tga files in height fields when the tga file is 
  2253. created in a paint program.  A gif file is a better choice for paint 
  2254. created height fields in 8 bits.  Also see Appendix B.5 for a tip on 
  2255. creating tga files for height fields.
  2256.  
  2257. An optional "water_level" parameter may be added after the file name.  It 
  2258. consists of the keyword "water_level" followed by a float value tells the 
  2259. program not to look for the height field below that value. Default value is 
  2260. 0, and legal values are between 0 and 1. For example, "water_level .5" 
  2261. tells POV-Ray to only render the top half of the height field. The other 
  2262. half is "below the water" and couldn't be seen anyway. This term comes from 
  2263. the popular use of height fields to render landscapes. A height field would 
  2264. be used to create islands and another shape would be used to simulate water 
  2265. around the islands. A large portion of the height field would be obscured 
  2266. by the "water" so the "water_level" parameter was introduced to allow the 
  2267. ray-tracer to ignore the unseen parts of the height field. Water_level is 
  2268. also used to "cut away" unwanted lower values in a height field. For 
  2269. example, if you have an image of a fractal on a solid colored background, 
  2270. where the background color is palette entry 0, you can remove the 
  2271. background in the height field by specifying, "water_level .001" 
  2272.  
  2273. Normally height fields have a rough, jagged look because they are made of 
  2274. lots of flat triangles.  Adding the keyword "smooth" causes POV-Ray to 
  2275. modify the surface normal vectors of the triangles in such a way that the 
  2276. lighting and shading of the triangles will give a smooth look.  This may 
  2277. allow you to use a lower resolution file for your height field than would 
  2278. otherwise be needed.
  2279.  
  2280. Height fields can be used in CSG shapes and they can be scaled, rotated and 
  2281. translated. Because they are finite they respond to automatic bounding.  
  2282.  
  2283. Here are a notes and helpful hints on height fields from their creator, 
  2284. Doug Muir:
  2285.  
  2286. The height field is mapped to the x-z plane, with its lower left corner 
  2287. sitting at the origin. It extends to 1 in the positive x direction and to 1 
  2288. in the positive z direction. It is maximum 1 unit high in the y direction. 
  2289. You can translate it, scale it, and rotate it to your heart's content. 
  2290.  
  2291. When deciding on what water_level to use, remember, this applies to the un-
  2292. transformed height field. If you are a Fractint user, the water_level 
  2293. should be used just like the water_level parameter for 3d projections in 
  2294. Fractint.
  2295.  
  2296. Here's a detailed explanation of how the ray-tracer creates the height 
  2297. field. You can skip this if you aren't interested in the technical side of 
  2298. ray-tracing. This information is not needed to create or use height fields.
  2299.  
  2300. To find an intersection with the height field, the ray tracer first checks 
  2301. to see if the ray intersects the box which surrounds the height field. 
  2302. Before any transformations, this box's two opposite vertexes are at (0, 
  2303. water_level, 0) and (1, 1, 1). If the box is intersected, the ray tracer 
  2304. figures out where, and then follows the line from where the ray enters the 
  2305. box to where it leaves the box, checking each pixel it crosses for an 
  2306. intersection. 
  2307.  
  2308. It checks the pixel by dividing it up into two triangles. The height vertex 
  2309. of the triangle is determined by the color index at the corresponding 
  2310. position in the GIF, POT, or TGA file.
  2311.  
  2312. If your file has a uses the color map randomly, your height field is going 
  2313. to look pretty chaotic, with tall, thin spikes shooting up all over the 
  2314. place. Not every GIF will make a good height field.
  2315.  
  2316. If you want to get an idea of what your height field will look like, I 
  2317. recommend using the IBM-PC program Fractint's 3d projection features to do 
  2318. a sort of preview. If it doesn't look good there, the ray tracer isn't 
  2319. going to fix it. For those of you who can't use Fractint, convert the image 
  2320. palette to a gray scale from black at entry 0 to white at entry 255 with 
  2321. smooth steps of gray in-between. The dark parts will lower than the 
  2322. brighter parts, so you can get a feel for how the image will look as a 
  2323. height field.
  2324.  
  2325.  
  2326. 5.2.2 FINITE PATCH PRIMITIVES
  2327.  
  2328. There are 4 totally thin, finite objects which have NO well-defined inside.  
  2329. They may be combined in CSG union but cannot be use in other types of CSG.  
  2330. They are bicubic_patch, disc, smooth_triangle and triangle.  Because these 
  2331. types are finite, POV-Ray can use automatic bounding on them to speed up 
  2332. rendering time.  
  2333.  
  2334.  
  2335. 5.2.2.1     Triangle and Smooth_triangle 
  2336.  
  2337. The triangle primitive is available in order to make more complex objects 
  2338. than the built-in shapes will permit.  Triangles are usually not created by 
  2339. hand, but are converted from other files or generated by utilities. 
  2340.  
  2341. A triangle is defined by:
  2342.  
  2343.    triangle { <CORNER1>, <CORNER2>, <CORNER3> }
  2344.  
  2345. where <CORNERn> is a vector defining the x,y,z coordinates of each corner 
  2346. of the triangle.
  2347.  
  2348. Because triangles are perfectly flat surfaces it would require extremely 
  2349. large numbers of very small triangles to approximate a smooth, curved 
  2350. surface.  However much of our perception of smooth surfaces is dependent 
  2351. upon the way light and shading is done.  By artificially modifying the 
  2352. surface normals we can simulate as smooth surface and hide the sharp-edged 
  2353. seams between individual triangles. 
  2354.  
  2355. The smooth_triangle primitive is used for just such purposes.  The 
  2356. smooth_triangles use a formula called Phong normal interpolation to 
  2357. calculate the surface normal for any point on the triangle based on normal 
  2358. vectors which you define for the three corners.  This makes the triangle 
  2359. appear to be a smooth curved surface. A smooth_triangle is defined by:
  2360.  
  2361.   smooth_triangle {
  2362.     <CORNER1>, <NORMAL1>,
  2363.     <CORNER2>, <NORMAL2>,
  2364.     <CORNER3>, <NORMAL3>
  2365.   }
  2366.  
  2367. where the corners are defined as in regular triangles and <NORMALn> is a 
  2368. vector describing the direction of the surface normal at each corner.
  2369.  
  2370. These normal vectors are prohibitively difficult to compute by hand.  
  2371. Therefore smooth_triangles are almost always generated by utility programs.  
  2372. To achieve smooth results, any triangles which share a common vertex should 
  2373. have the same normal vector at that vertex.  Generally the smoothed normal 
  2374. should be the average of all the actual normals of the triangles which 
  2375. share that point.
  2376.  
  2377.  
  2378. 5.2.2.2     Bicubic_patch
  2379.  
  2380. A bicubic patch is a 3D curved surface created from a mesh of triangles. 
  2381. POV-Ray supports a type of bicubic patch called a Bezier patch.  A bicubic 
  2382. patch is defined as follows:
  2383.  
  2384.   bicubic_patch { 
  2385.      type PATCH_TYPE
  2386.      flatness FLATNESS_VALUE
  2387.      u_steps NUM_U_STEPS
  2388.      v_steps NUM_V_STEPS
  2389.      <CP1>,  <CP2>,   <CP3>,   <CP4>,
  2390.      <CP5>,  <CP6>,   <CP7>,   <CP8>,
  2391.      <CP9>,  <CP10>,  <CP11>,  <CP12>,
  2392.      <CP13>, <CP14>,  <CP15>,  <CP16>
  2393.   }
  2394.  
  2395. The keyword "type" is followed by a float PATCH_TYPE which currently must 
  2396. be either 0 or 1.  For type 0 only the control points are retained within 
  2397. POV-Ray. This means that a minimal amount of memory is needed, but POV-Ray 
  2398. will need to perform many extra calculations when trying to render the 
  2399. patch.  Type 1 preprocesses the patch into many subpatches.  This results 
  2400. in a significant speedup in rendering, at the cost of memory.
  2401.  
  2402. These 4 parameters: type, flatness, u_steps & v_steps, may appear in any 
  2403. order.  They are followed by 16 vectors that define the x,y,z coordinates 
  2404. of the 16 control points which define the patch.  The patch touches the 4 
  2405. corner points <CP1>, <CP4>, <CP13> and <CP16> while the other 12 points 
  2406. pull and stretch the patch into shape.
  2407.  
  2408. The keywords "u_steps" and "v_steps" are each followed by float values 
  2409. which tell how many rows and columns of triangles are the minimum to use to 
  2410. create the surface.  The maximum number of individual pieces of the patch 
  2411. that are tested by POV-Ray can be calculated from the following:
  2412.  
  2413.    sub-pieces = 2^u_steps * 2^v_steps
  2414.  
  2415. This means that you really should keep "u_steps" and "v_steps" under 4 or 
  2416. 5.  Most patches look just fine with "u_steps 3" and "v_steps 3", which 
  2417. translates to 64 subpatches (128 smooth triangles).
  2418.  
  2419. As POV-Ray processes the Bezier patch, it makes a test of the current piece 
  2420. of the patch to see if it is flat enough to just pretend it is a rectangle.  
  2421. The statement that controls this test is: "flatness xxx".  Typical flatness 
  2422. values range from 0 to 1 (the lower the slower).
  2423.  
  2424. If the value for flatness is 0, then POV-Ray will always subdivide the 
  2425. patch to the extend specified by u_steps and v_steps.  If flatness is 
  2426. greater than 0, then every time the patch is split, POV-Ray will check to 
  2427. see if there is any need to split further.
  2428.  
  2429. There are both advantages and disadvantages to using a non-zero flatness.  
  2430. The advantages include:
  2431.  
  2432.    If the patch isn't very curved, then this will be detected and POV-Ray
  2433.    won't waste a lot of time looking at the wrong pieces.
  2434.  
  2435.    If the patch is only highly curved in a couple of places, POV-Ray will
  2436.    keep subdividing there and concentrate it's efforts on the hard part.
  2437.  
  2438. The biggest disadvantage is that if POV-Ray stops subdividing at a 
  2439. particular level on one part of the patch and at a different level on an 
  2440. adjacent part of the patch, there is the potential for "cracking".  This is 
  2441. typically visible as spots within the patch where you can see through.  How 
  2442. bad this appears depends very highly on the angle at which you are viewing 
  2443. the patch.
  2444.  
  2445. Like triangles, the bicubic patch is not meant to be generated by hand.  
  2446. These shapes should be created by a special utility. You may be able to 
  2447. acquire utilities to generate these shapes from the same source from which 
  2448. you obtained POV-Ray. 
  2449.  
  2450. Example:
  2451.   bicubic_patch { 
  2452.      type 1 
  2453.      flatness 0.01
  2454.      u_steps 4
  2455.      v_steps 4
  2456.      <0, 0, 2>, <1, 0, 0>, <2, 0, 0>, <3, 0,-2>,
  2457.      <0, 1  0>, <1, 1, 0>, <2, 1, 0>, <3, 1, 0>,
  2458.      <0, 2, 0>, <1, 2, 0>, <2, 2, 0>, <3, 2, 0>,
  2459.      <0, 3, 2>, <1, 3, 0>, <2, 3, 0>, <3, 3, -2>
  2460.   }
  2461.  
  2462. The triangles in a POV-Ray bicubic_patch are automatically smoothed using 
  2463. normal interpolation but it is up to the user (or the user's utility 
  2464. program) to create control points which smoothly stitch together groups of 
  2465. patches.  
  2466.  
  2467. As with the other shapes, bicubic_patch objects can be translated, rotated, 
  2468. and scaled.  Because they are finite they respond to automatic bounding.  
  2469. Since it's made from triangles, a bicubic_patch cannot be used in CSG 
  2470. intersection or difference types or inside a clipped_by modifier because 
  2471. triangles have no clear "inside". The CSG union type works acceptably.
  2472.  
  2473.  
  2474. 5.2.2.3     Disc
  2475.  
  2476. One other flat, finite object type is available with POV-Ray.  Note that a 
  2477. disc is infinitely thin.  It has no thickness.  If you want a disc with 
  2478. true thickness you should use a very short cylinder.  A disc shape may be 
  2479. defined by:
  2480.  
  2481.   disc { <CENTER>, <NORMAL>, RADIUS }
  2482.  
  2483. or 
  2484.  
  2485.   disc { <CENTER>, <NORMAL>, RADIUS, HOLE_RADIUS }
  2486.  
  2487. The vector <CENTER> defines the x,y,z coordinates of the center of the 
  2488. disc.  The <NORMAL> vector describes its orientation by describing its 
  2489. surface normal vector.  This is followed by a float specifying the RADIUS.  
  2490. This may be optionally followed by another float specifying the radius of a 
  2491. hole to be cut from the center of the disc.
  2492.  
  2493. Example:
  2494.   disc {
  2495.     <-2,-0.5, 0>,    //center location
  2496.     <0,  1,   0>,    //normal vector
  2497.     2                //radius         
  2498.     pigment { color Cyan }
  2499.   }
  2500.  
  2501.   disc {
  2502.     <0, 1, 0>,       //center location
  2503.     <-1, 3, -2>,     //normal vector  
  2504.     1.5,             //radius         
  2505.     0.5              //hole radius (optional)
  2506.     pigment { color Yellow }
  2507.   }
  2508.  
  2509. As with the other shapes, discs can be translated, rotated, and scaled.  
  2510. Because they are finite they respond to automatic bounding.  Disc cannot be 
  2511. used in CSG intersection or difference types or inside a clipped_by 
  2512. modifier because it has no clear "inside". The CSG union type works 
  2513. acceptably.
  2514.  
  2515.  
  2516. 5.2.3 INFINITE SOLID PRIMITIVES
  2517.  
  2518. There are 5 polynomial primitive shapes that are possibly infinite and do 
  2519. not respond to automatic bounding.  They do have a well defined inside and 
  2520. may be used in CSG.  They are plane, cubic, poly, quadric, and quartic.  
  2521.  
  2522.  
  2523. 5.2.3.1     Plane 
  2524.  
  2525. The plane primitive is a fast, efficient way to define an infinite flat 
  2526. surface.  The plane is specified as follows:
  2527.  
  2528.   plane { <NORMAL>, DISTANCE }
  2529.  
  2530. The <NORMAL> vector defines the surface normal of the plane.  A surface 
  2531. normal is a vector which points up from the surface at a 90 degree angle.  
  2532. This is followed by a float value that gives the distance along the normal 
  2533. that the plane is from the origin.  For example:
  2534.  
  2535.   plane { <0,1,0>,4 }
  2536.  
  2537. This is a plane where "straight up" is defined in the positive y direction.  
  2538. The plane is 4 units in that direction away from the origin.  Because most 
  2539. planes are defined with surface normals in the direction of an axis, you 
  2540. will often see planes defined using the "x", "y", or "z" built-in vector 
  2541. identifiers.  The example above could be specified as:
  2542.  
  2543.   plane { y,4 }
  2544.  
  2545. The plane extends infinitely in the x and z directions.  It effectively 
  2546. divides the world into two pieces.  By definition the normal vector points 
  2547. to the outside of the plane while any points away from the vector are 
  2548. defined as inside.  This inside/outside distinction is only important when 
  2549. using planes in CSG.
  2550.  
  2551. As with the other shapes, planes can be translated, rotated, and scaled.  
  2552. Because they are infinite they do not respond to automatic bounding.  Plane 
  2553. can be used freely in CSG because it has a clear defined "inside". 
  2554.  
  2555. A plane is called a "polynomial" shape because it is defined by a first 
  2556. order polynomial equation.  Given a plane:
  2557.  
  2558.   plane { <A, B, C>, D }
  2559.  
  2560. it can be represented by the formula:
  2561.  
  2562.    A*x + B*y + C*z = D
  2563.  
  2564. Therefore our example "plane {y,4}" is actually the polynomial equation 
  2565. "y=4".  You can think of this as a set of all x,y,z points where all have y 
  2566. values equal to 4, regardless of the x or z values.
  2567.  
  2568. This equation is a "first order" polynomial because each term contains only 
  2569. single powers of x, y or z.  A second order equation has terms like x^2, 
  2570. y^2, z^2, xy, xz and yz.  Another name for a 2nd order equation is a 
  2571. quadric equation.  Third order polys are called cubics.  A 4th order 
  2572. equation is a quartic.  Such shapes are described in the sections below.
  2573.  
  2574.  
  2575. 5.2.3.2     Quadric 
  2576.  
  2577. Quadric surfaces can produce shapes like ellipsoids, spheres, cones, 
  2578. cylinders, paraboloids (dish shapes), and hyperboloids (saddle or hourglass 
  2579. shapes).  NOTE: Do not confuse "quaDRic" with "quaRTic".  A quadric is a 
  2580. 2nd order polynomial while a quartic is 4th order.
  2581.  
  2582. A quadric is defined in POV-Ray by:
  2583.  
  2584.   quadric { <A,B,C>, <D,E,F>, <G,H,I>, J }
  2585.  
  2586. where A through J are float expressions.  
  2587.  
  2588. This defines a surface of x,y,z points which satisfy the equation:
  2589.  
  2590.        A x^2   + B y^2   + C z^2
  2591.      + D xy    + E xz    + F yz
  2592.      + G x     + H y     + I z    + J = 0
  2593.  
  2594. Different values of A,B,C,...J will give different shapes. So, if you take 
  2595. any three dimensional point and use its x, y, and z coordinates in the 
  2596. above equation, the answer will be 0 if the point is on the surface of the 
  2597. object. The answer will be negative if the point is inside the object and 
  2598. positive if the point is outside the object. Here are some examples: 
  2599.  
  2600.      X^2 + Y^2 + Z^2 - 1 = 0  Sphere
  2601.      X^2 + Y^2 - 1 = 0        Infinitely long cylinder along the Z axis 
  2602.      X^2 + Y^2 - Z^2 = 0      Infinitely long cone along the Z axis
  2603.  
  2604. The easiest way to use these shapes is to include the standard file 
  2605. "SHAPES.INC" into your program. It contains several pre-defined quadrics 
  2606. and you can transform these pre-defined shapes (using translate, rotate, 
  2607. and scale) into the ones you want.
  2608.  
  2609. You can invoke them by using the syntax,
  2610.  
  2611.   object { Quadric_Name }
  2612.  
  2613. The pre-defined quadrics are centered about the origin <0, 0, 0> and have a 
  2614. radius of 1. Don't confuse radius with width. The radius is half the 
  2615. diameter or width making the standard quadrics 2 units wide.
  2616.  
  2617. Some of the pre-defined quadrics are,
  2618.  
  2619.  Ellipsoid
  2620.  Cylinder_X, Cylinder_Y, Cylinder_Z
  2621.  QCone_X, QCone_Y, QCone_Z
  2622.  Paraboloid_X, Paraboloid_Y, Paraboloid_Z
  2623.  
  2624. For a complete list, see the file SHAPES.INC.
  2625.  
  2626.  
  2627. 5.2.3.3     Poly, Cubic and Quartic.  
  2628.  
  2629. Higher order polynomial surfaces may be defined by the use of a poly shape.  
  2630. The syntax is:
  2631.  
  2632.   poly { ORDER, <T1, T2, T3, .... Tm> }
  2633.  
  2634. Where ORDER is a whole number from 2 to 7 inclusively that specifies the 
  2635. order of the equation.  T1, T2... Tm are float values for the coefficients 
  2636. of the equation.  There are "m" such terms where 
  2637.  
  2638.     m=((ORDER+1)*(ORDER+2)*(ORDER+3))/6
  2639.  
  2640. An alternate way to specify 3rd order polys is:
  2641.  
  2642.   cubic { <T1, T2,... T20> }
  2643.  
  2644. Also 4th order equations may be specified with:
  2645.  
  2646.   quartic { <T1, T2,... T35> }
  2647.  
  2648. Here's a more mathematical description of quartics for those who are 
  2649. interested.  Quartic surfaces are 4th order surfaces, and can be used to 
  2650. describe a large class of shapes including the torus, the lemniscate, etc. 
  2651. The general equation for a quartic equation in three variables is (hold 
  2652. onto your hat):
  2653.  
  2654.   a00 x^4 + a01 x^3 y + a02 x^3 z+ a03 x^3 + a04 x^2 y^2+ 
  2655.   a05 x^2 y z+ a06 x^2 y + a07 x^2 z^2+a08 x^2 z+a09 x^2+
  2656.   a10 x y^3+a11 x y^2 z+ a12 x y^2+a13 x y z^2+a14 x y z+ 
  2657.   a15 x y + a16 x z^3 + a17 x z^2 + a18 x z + a19 x+
  2658.   a20 y^4 + a21 y^3 z + a22 y^3+ a23 y^2 z^2 +a24 y^2 z+ 
  2659.   a25 y^2 + a26 y z^3 + a27 y z^2 + a28 y z + a29 y+ 
  2660.   a30 z^4 + a31 z^3 + a32 z^2 + a33 z + a34
  2661.  
  2662. To declare a quartic surface requires that each of the coefficients (a0 -> 
  2663. a34) be placed in order into a single long vector of 35 terms. 
  2664.  
  2665. As an example let's define a torus the hard way.  A Torus can be 
  2666. represented by the equation:
  2667.  
  2668.  x^4 + y^4 + z^4 + 2 x^2 y^2 + 2 x^2 z^2 + 2 y^2 z^2
  2669.  -2 (r0^2 + r1^2) x^2 + 2 (r0^2 - r1^2) y^2 
  2670.  -2 (r0^2 + r1^2) z^2 + (r0^2 - r1^2)^2 = 0
  2671.  
  2672. Where r0 is the "major" radius of the torus - the distance from the hole of 
  2673. the donut to the middle of the ring of the donut, and r1 is the "minor" 
  2674. radius of the torus - the distance from the middle of the ring of the donut 
  2675. to the outer surface. The following object declaration is for a torus 
  2676. having major radius 6.3 minor radius 3.5 (Making the maximum width just 
  2677. under 10). 
  2678.  
  2679. //Torus having major radius sqrt(40), minor radius sqrt(12)
  2680.  
  2681.    quartic {
  2682.       < 1,   0,   0,   0,   2,   0,   0,   2,   0, 
  2683.      -104,   0,   0,   0,   0,   0,   0,   0,   0, 
  2684.         0,   0,   1,   0,   0,   2,   0,  56,   0, 
  2685.         0,   0,   0,   1,   0, -104,  0, 784 >
  2686.       sturm
  2687.       bounded_by { // bounded_by speeds up the render,
  2688.                    // see bounded_by
  2689.                    // explanation later 
  2690.                    // in docs for more info.
  2691.        sphere { <0, 0, 0>, 10 }
  2692.       }
  2693.    }
  2694.  
  2695. Poly, cubic and quartics are just like quadrics in that you don't have to 
  2696. understand what one is to use one. The file SHAPESQ.INC has plenty of pre-
  2697. defined quartics for you to play with. The most common one is the torus or 
  2698. donut. The syntax for using a pre-defined quartic is:
  2699.  
  2700.     object { Quartic_Name }
  2701.  
  2702. As with the other shapes, these shapes can be translated, rotated, and 
  2703. scaled.  Because they are infinite they do not respond to automatic 
  2704. bounding.  They can be used freely in CSG because they have a clear defined 
  2705. "inside". 
  2706.  
  2707. Polys use highly complex computations and will not always render perfectly. 
  2708. If the surface is not smooth, has dropouts, or extra random pixels, try 
  2709. using the optional keyword "sturm" in the definition. This will cause a 
  2710. slower, but more accurate calculation method to be used. Usually, but not 
  2711. always, this will solve the problem. If sturm doesn't work, try rotating, 
  2712. or translating the shape by some small amount. See the sub-directory MATH 
  2713. for examples of polys in scenes.
  2714.  
  2715. There are really so many different quartic shapes, we can't even begin to 
  2716. list or describe them all. If you are interested and mathematically 
  2717. inclined, an excellent reference book for curves and surfaces where you'll 
  2718. find more quartic shape formulas is:
  2719.  
  2720.    "The CRC Handbook of Mathematical Curves and Surfaces"
  2721.    David von Seggern
  2722.    CRC Press
  2723.    1990
  2724.  
  2725.  
  2726. 5.2.4 CONSTRUCTIVE SOLID GEOMETRY (CSG)
  2727.  
  2728. POV-Ray supports Constructive Solid Geometry (also called Boolean 
  2729. operations) in order to make the shape definition abilities more powerful.
  2730.  
  2731.  
  2732. 5.2.4.1     About CSG
  2733.        
  2734. The simple shapes used so far are nice, but not terribly useful on their 
  2735. own for making realistic scenes. It's hard to make interesting objects when 
  2736. you're limited to spheres, boxes, cylinders, planes, and so forth. 
  2737.        
  2738. Constructive Solid Geometry (CSG) is a technique for taking these simple 
  2739. building blocks and combining them together. You can use a cylinder to bore 
  2740. a hole through a sphere. You can start with solid blocks and carve away 
  2741. pieces.  Objects may be combined in groups and treated as though they were 
  2742. single objects.
  2743.        
  2744. Constructive Solid Geometry allows you to define shapes which are the 
  2745. union, intersection, or difference of other shapes.  Additionally you may 
  2746. clip sections of objects revealing their hollow interiors.
  2747.        
  2748. Unions superimpose two or more shapes. This has the same effect as defining 
  2749. two or more separate objects, but is simpler to create and/or manipulate. 
  2750. In POV-Ray 2.0 the union keyword may be used anyplace composite was used in 
  2751. previous versions of POV-Ray.  Also a new type of union called "merge" can 
  2752. eliminate internal surfaces on transparent or clipped objects.
  2753.        
  2754. Intersections define the space where the two or more surfaces overlap.
  2755.        
  2756. Differences allow you to cut one object out of another.
  2757.        
  2758. CSG intersections, unions, and differences can consist of two or more 
  2759. shapes. For example:
  2760.        
  2761.           union {
  2762.             object{O1}
  2763.             object{O2}
  2764.             object{O3}  // any number of objects 
  2765.             texture{T1}
  2766.           }
  2767.        
  2768. CSG shapes may be used in CSG shapes. In fact, CSG shapes may be used 
  2769. anyplace that a standard shape is used.
  2770.        
  2771. The order of the component shapes with the CSG doesn't matter except in a 
  2772. difference shape. For CSG differences, the first shape is visible and the 
  2773. remaining shapes are cut out of the first.
  2774.        
  2775. Constructive solid geometry shapes may be translated, rotated, or scaled in 
  2776. the same way as any shape. The shapes making up the CSG shape may be 
  2777. individually translated, rotated, and scaled as well.
  2778.        
  2779. When using CSG, it is often useful to invert a shape so that it's inside-
  2780. out. The appearance of the shape is not changed, just the way that POV-Ray 
  2781. perceives it. The inverse keyword can be used to do this for any shape. 
  2782. When inverse is used, the "inside" of the shape is flipped to become the 
  2783. "outside". For planes, "inside" is defined to be "in the opposite direction 
  2784. to the "normal" or "up" direction. 
  2785.        
  2786. Note that performing an intersection between a shape and some other inverse 
  2787. shapes is the same as performing a difference. In fact, the difference is 
  2788. actually implemented in this way in the code.
  2789.        
  2790.  
  2791. 5.2.4.2     Inside and outside
  2792.  
  2793. Most shape primitives, like spheres, boxes, and blobs, divide the world 
  2794. into two regions. One region is inside the surface and one is outside.  
  2795. (The exceptions to this rule are triangles, disc and bezier patches - we'll 
  2796. talk about this later.)
  2797.        
  2798. Given any point in space, you can say it's either inside or outside any 
  2799. particular primitive object (well, it could be exactly on the surface, but 
  2800. numerical inaccuracies will put it to one side or the other). 
  2801.        
  2802. Even planes have an inside and an outside. By definition, the surface 
  2803. normal of the plane points towards the outside of the plane. (For a simple 
  2804. floor, for example, the space above the floor is "outside" and the space 
  2805. below the floor is "inside". For simple floors this in un-important, but 
  2806. for planes as parts of CSG's it becomes much more important). CSG uses the 
  2807. concepts of inside and outside to combine shapes together. Take the 
  2808. following situation:
  2809.        
  2810. Note: The diagrams shown here demonstrate the concepts in 2D and are 
  2811. intended only as an analogy to the 3D case. 
  2812.        
  2813. Note that the triangles and triangle-based shapes cannot be used as solid 
  2814. objects in CSG since they have no clear inside and outside.
  2815.  
  2816. In this diagram, point 1 is inside object A only.  Point 2 is inside B 
  2817. only.  Point 3 is inside both A and B while point 0 is outside everything.
  2818.        
  2819.          * = Object A
  2820.          % = Object B
  2821.        
  2822.                             *  0
  2823.                            * *    %
  2824.                           *   *  % %
  2825.                          *     *%   %
  2826.                         *  1   %*    %
  2827.                        *      %  * 2  %
  2828.                       *      % 3  *    %
  2829.                      *******%*******    %
  2830.                            %             %
  2831.                           %%%%%%%%%%%%%%%%%
  2832.        
  2833.        
  2834. Complex shapes may be created by combining other shapes using a technique 
  2835. called "Constructive Solid Geometry" (or CSG for short).  The CSG shapes 
  2836. are difference, intersection, and union. The following gives a simple 2D 
  2837. overview of how these functions work. 
  2838.  
  2839. 5.2.4.3     Union  
  2840.  
  2841. Unions are simply "glue", used bind two or more shapes into a single entity 
  2842. that can be manipulated as a single object.  The diagram above shows the 
  2843. union of A and B.  The new object created by the union operation can then 
  2844. be scaled, translated, and rotated as a single shape.  The entire union can 
  2845. share a single texture, but each object contained in the union may also 
  2846. have its own texture, which will override any matching texture statements 
  2847. in the parent object:
  2848.  
  2849.       union {
  2850.         sphere { <0, 0.5, 0> 1 pigment { Red } }
  2851.         sphere { <0, 0.0, 0> 1 }
  2852.         sphere { <0,-0.5, 0> 1 }
  2853.         pigment { Blue }
  2854.         finish { Shiny }
  2855.       }
  2856.  
  2857. This union will contain three spheres.  The first sphere is explicitly 
  2858. colored Red while the other two will be shiny blue.  Note that the shiny 
  2859. finish does NOT apply to the first sphere.  This is because the 
  2860. "pigment{Red}" is actually shorthand for "texture{pigment{Red}}".  It 
  2861. attaches an entire texture with default normals and finish.  The textures 
  2862. or pieces of textures attached to the union apply ONLY to components with 
  2863. no textures.  These texturing rules also apply to intersection, difference 
  2864. and merge as well.
  2865.  
  2866. Earlier versions of POV-Ray placed restrictions on unions so you often had 
  2867. to combine objects with composite statements.  Those earlier restrictions 
  2868. have been lifted so composite is no longer needed.  Composite is still 
  2869. supported for backwards compatibility but it is recommended that union now 
  2870. be used in it's place since future support for the composite keyword is not 
  2871. guarantied.
  2872.  
  2873.  
  2874. 5.2.4.4     Intersection
  2875.  
  2876. A point is inside the intersection if it's inside both A AND B. This 
  2877. "logical AND's" the shapes and gets the common part, most useful for 
  2878. "cutting" infinite shapes off.  The diagram below consists of only those 
  2879. parts common to A and B.
  2880.        
  2881.        
  2882.                                %*
  2883.                               %  *
  2884.                              % 3  *
  2885.                             %*******
  2886.        
  2887. For example:
  2888.  
  2889.      intersection {
  2890.        sphere {<-0.75,0,0>,1}
  2891.        sphere {< 0.75,0,0>,1}
  2892.        pigment {Yellow}
  2893.      }
  2894.  
  2895.  
  2896. 5.2.4.5     Difference
  2897.  
  2898. A point is inside the difference if it's inside A but not inside B. The 
  2899. results is a "subtraction" of the 2nd shape from the first shape:
  2900.        
  2901.                             *
  2902.                            * *
  2903.                           *   *
  2904.                          *     *
  2905.                         *  1   %
  2906.                        *      %
  2907.                       *      %
  2908.                      *******%
  2909.        
  2910. For example:
  2911.  
  2912.      difference {
  2913.        sphere {<-0.75,0,0>,1}
  2914.        sphere {< 0.75,0,-0.25>,1}
  2915.        pigment {Yellow}
  2916.      }
  2917.  
  2918.  
  2919. 5.2.4.6     Merge
  2920.  
  2921. As can be seen in the diagram for union, the inner surfaces where the 
  2922. objects overlap is still present.  On transparent or clipped objects these 
  2923. inner surfaces cause problems.  A merge object works just like union but it 
  2924. eliminates the inner surfaces like this:
  2925.  
  2926.                             *  
  2927.                            * *    %
  2928.                           *   *  % %
  2929.                          *     *%   %
  2930.                         *            %
  2931.                        *              %
  2932.                       *                %
  2933.                      *******%           %
  2934.                            %             %
  2935.                           %%%%%%%%%%%%%%%%%
  2936.        
  2937.        
  2938.  
  2939. 5.2.5 LIGHT SOURCES
  2940.  
  2941. The last object we'll cover is the light source.  Light sources have no 
  2942. visible shape of their own.  They are just points or areas which emit 
  2943. light.
  2944.  
  2945.  
  2946. 5.2.5.1     Point Lights
  2947.  
  2948. Most light sources are infinitely small points which emit light.  Point 
  2949. light sources are treated like shapes, but they are invisible points from 
  2950. which light rays stream out. They light objects and create shadows and 
  2951. highlights. Because of the way ray tracing works, lights do not reflect 
  2952. from a surface.  You can use many light sources in a scene, but each light 
  2953. source used will increase rendering time. The brightness of a light is 
  2954. determined by its color. A bright color is a bright light, a dark color, a 
  2955. dark one. White is the brightest possible light, Black is completely dark 
  2956. and Gray is somewhere in the middle.
  2957.  
  2958. The syntax for a light source is:
  2959.  
  2960.     light_source { <X, Y, Z> color red #, green #, blue #}
  2961.  
  2962. Where X, Y and Z are the coordinates of the location and "color" is any 
  2963. color or color identifier. For example,
  2964.  
  2965.     light_source { <3, 5, -6> color Gray50}
  2966.  
  2967. is a 50% Gray light at X=3, Y=5, Z=-6.
  2968.  
  2969. Point light sources in POV-Ray do not attenuate, or get dimmer, with 
  2970. distance.
  2971.  
  2972.  
  2973. 5.2.5.2     Spotlights
  2974.  
  2975. A spotlight is a point light source where the rays of light are constrained 
  2976. by a cone. The light is bright in the center of the spotlight and falls 
  2977. off/darkens to soft shadows at the edges of the circle.
  2978.  
  2979. The syntax is:
  2980.  
  2981. Syntax:   light_source { <CENTER>
  2982.               color red #, green #, blue #
  2983.               spotlight
  2984.               point_at <POINT>
  2985.               radius #
  2986.               falloff #
  2987.               tightness #
  2988.           }
  2989.  
  2990. A spotlight is positioned using two vectors.  The first vector is the usual 
  2991. <CENTER> vector that you would use to position a point light source.
  2992.  
  2993. The second vector is the point_at <POINT>, the vector position of
  2994. the point the light is pointing at, similar to the look_at in a camera 
  2995. description.
  2996.  
  2997. The following illustrations will be helpful in understanding how these 
  2998. values relate to each other:
  2999.  
  3000.  
  3001.            (+) Spotlight <center>
  3002.            / \
  3003.           /   \
  3004.          /     \
  3005.         /       \
  3006.        /         \
  3007.       /           \
  3008.       +-----*-----+
  3009.             ^ point_at <point>
  3010.  
  3011. The center is specified the same way as a normal point light_source.
  3012.  
  3013. Point_at <POINT> is the location that the cone of light is
  3014. aiming at.
  3015.  
  3016. Spotlights also have three other parameters: radius, falloff, and 
  3017. tightness.
  3018.  
  3019. If you think of a spotlight as two nested cones,  the inner cone would be 
  3020. specified by the radius parameter, and would be fully lit.  The outer cone 
  3021. would be the falloff cone and beyond it would be totally unlit.  The values 
  3022. for these two parameters are specified in degrees of the half angle at the 
  3023. peak of each cone:
  3024.  
  3025.  
  3026.            (+) Spotlight <center>
  3027.             |\ <-----  angle measured here
  3028.             | \
  3029.             || \
  3030.             ||  \      shaded area = radius cone
  3031.             |||  \     outer line = falloff cone
  3032.             ||||  \
  3033.             |||||  \
  3034.             +-------+
  3035.  
  3036. The radius# is the radius, in degrees, of the bright circular hotspot at 
  3037. the center of the spotlight's area of affect.
  3038.  
  3039. The falloff# is the falloff angle of the radius of the total spotlight 
  3040. area, in degrees. This is the value where the light "falls off" to zero 
  3041. brightness.  Falloff should be larger than the radius. Both values should 
  3042. be between 1 and 180.
  3043.  
  3044. The tightness value specifies how quickly the light dims, or falls off, in 
  3045. the region between the radius (full brightness) cone and the falloff (full 
  3046. darkness) cone.  The default value for tightness is 10.  Lower tightness 
  3047. values will make the spot have very soft edges. High values will make the 
  3048. edges sharper, the spot "tighter".  Values from 1 to 100 are acceptable.
  3049.  
  3050. Spotlights may used anyplace that a normal light source is used. Like 
  3051. normal light sources, they are invisible points. They are treated as shapes 
  3052. and may be included in CSG shapes.  They may also be used in conjunction 
  3053. with area_lights.
  3054.  
  3055. Example:
  3056.    // This is the spotlight.
  3057.    light_source {
  3058.       <10, 10, 0>
  3059.       color red 1, green 1, blue 0.5
  3060.       spotlight
  3061.       point_at <0, 1, 0>
  3062.       tightness 50
  3063.       radius 11
  3064.       falloff 25
  3065.      }
  3066.  
  3067.  
  3068.  
  3069. 5.2.3.3     Area Lights
  3070.  
  3071. Regular light sources in POV-Ray are modeled as point light sources, that 
  3072. is they emit light from a single point in space. Because of this the 
  3073. shadows created by these lights have the characteristic sharp edges that 
  3074. most of us are use to seeing in ray traced images. The reason for the 
  3075. distinct edges is that a point light source is either fully in view or it 
  3076. is fully blocked by an object. A point source can never be partially 
  3077. blocked.
  3078.  
  3079. Area lights on the other hand occupy a finite area of space. Since it is 
  3080. possible for an area light to be partially blocked by an object the shadows 
  3081. created will have soft or "fuzzy" edges. The softness of the edge is 
  3082. dependent on the dimensions of the light source and it's distance from the 
  3083. object casting the shadow.
  3084.  
  3085. The area lights used in POV-Ray are rectangular in shape, sort of like a 
  3086. flat panel light. Rather than performing the complex calculations that 
  3087. would be required to model a true area light, POV-Ray approximates an area 
  3088. light as an array of "point" light sources spread out over the area 
  3089. occupied by the light. The intensity of each individual point light in the 
  3090. array is dimmed so that the total amount of light emitted by the light is 
  3091. equal to the light color specified in the declaration.
  3092.  
  3093.  
  3094. Syntax:
  3095.  
  3096. light_source {
  3097.    <X, Y, Z> color red # green # blue #
  3098.  
  3099.    area_light <X1, Y1, Z1>, <X2, Y2, Z2>, N1, N2
  3100.    adaptive #
  3101.    jitter
  3102.  
  3103.    [optional spotlight parameters]
  3104. }
  3105.  
  3106. The light's location and color are specified in the same way as a
  3107. regular light source.
  3108.  
  3109. The area_light command defines the size and orientation of the area light 
  3110. as well as the number of lights in the light source array.  The vectors 
  3111. <X1,Y1,Z1> and <X2,Y2,Z2> specify the lengths and directions of the edges 
  3112. of the light. Since the area lights are rectangular in shape these vectors 
  3113. should be perpendicular to each other. The larger the size of the light the 
  3114. thicker that the soft part of the shadow will be. The numbers N1 and N2 
  3115. specify the dimensions of the array of point lights. The larger the number 
  3116. of lights you use the smoother your shadows will be but the longer they 
  3117. will take to render.
  3118.  
  3119. The adaptive command is used to enable adaptive sampling of the light 
  3120. source. By default POV-Ray calculates the amount of light that reaches a 
  3121. surface from an area light by shooting a test ray at every point light 
  3122. within the array. As you can imagine this is VERY slow. Adaptive sampling 
  3123. on the other hand attempts to approximate the same calculation by using a 
  3124. minimum number of test rays. The number specified after the keyword 
  3125. controls how much adaptive sampling is used. The higher the number the more 
  3126. accurate your shadows will be but the longer they will take to render. If 
  3127. you're not sure what value to use a good starting point is 'adaptive 1'.  
  3128. The adaptive command only accepts integer values and cannot be set lower 
  3129. than 0. Adaptive sampling is explained in more detail later.
  3130.  
  3131. The jitter command is optional. When used it causes the positions of the 
  3132. point lights in the array to be randomly jittered to eliminate any shadow 
  3133. banding that may occur. The jittering is completely random from render to 
  3134. render and should not be used when generating animations.
  3135.  
  3136. Note: It's possible to specify spotlight parameters along with area_light 
  3137. parameters to create "area spotlights." Using area spotlights is a good way 
  3138. to speed up scenes that use area lights since you can confine the lengthy 
  3139. soft shadow calculations to only the parts of your scene that need them.
  3140.  
  3141.  
  3142. Example:
  3143.  
  3144. light_source {
  3145.    <0, 50, 0> color White
  3146.  
  3147.    area_light <5, 0, 0>, <0, 0, 10>, 5, 5
  3148.    adaptive 1
  3149.    jitter
  3150. }
  3151.  
  3152. This defines an area light that extends 5 units along the x axis and 10 
  3153. units along the z axis and is centered at the location <0,50,0>. The light 
  3154. consists of a 5 by 5 jittered array of point sources for a total of 25 
  3155. point lights. A minimum of 9 shadow rays will be used each time this light 
  3156. is tested.
  3157.  
  3158.                      / * * * * *
  3159.                    / * * * * *           Y
  3160.         <0,0,10> / * * * * *             |     Z
  3161.                / * * * * *               |   /
  3162.              / * * * * *                 | /
  3163.            +----------->                 +------X
  3164.               <5,0,0>
  3165.  
  3166.  
  3167. An interesting effect that can be created using area lights is a linear 
  3168. light. Rather than having a rectangular shape, a linear light stretches 
  3169. along a line sort of like a thin fluorescent tube. To create a linear light 
  3170. just create an area light with one of the array dimensions set to 1.
  3171.  
  3172. Example:
  3173.  
  3174. light_source {
  3175.    <0, 50, 0> color White
  3176.  
  3177.    area_light <40, 0, 0>, <0, 0, 1>, 100, 1
  3178.    adaptive 4
  3179.    jitter
  3180. }
  3181.  
  3182. This defines a linear light that extends from <-40/2,50,0> to <+40/2,50,0> 
  3183. and consists of 100 point sources along it's length. The vector <0,0,1> is 
  3184. ignored in this case since a linear light has no width. Note: If the linear 
  3185. light is fairly long you'll usually need to set the adaptive parameter 
  3186. fairly high as in the above example.
  3187.  
  3188. When performing adaptive sampling POV-Ray starts by shooting a test ray at 
  3189. each of the four corners of the area light. If the amount of light received 
  3190. from all four corners is approximately the same then the area light is 
  3191. assumed to be either fully in view or fully blocked. The light intensity is 
  3192. then calculated as the average intensity of the light received from the 
  3193. four corners.  However, if the light intensity from the four corners 
  3194. differs significantly then the area light is partially blocked. The light 
  3195. is the split into four quarters and each section is sampled as described 
  3196. above. This allows POV-Ray to rapidly approximate how much of the area 
  3197. light is in view without having to shoot a test ray at every light in the 
  3198. array.
  3199.  
  3200. While the adaptive sampling method is fast (relatively speaking) it can 
  3201. sometimes produces inaccurate shadows. The solution is to reduce the amount 
  3202. of adaptive sampling without completely turning it off. The number after 
  3203. the adaptive keyword adjusts the number of times that the area light will 
  3204. be split before the adaptive phase begins. For example if you use "adaptive 
  3205. 0" a minimum of 4 rays will be shot at the light. If you use "adaptive 1" a 
  3206. minimum of 9 rays will be shot (adaptive 2 = 25 rays, adaptive 3 = 81 rays, 
  3207. etc). Obviously the more shadow rays you shoot the slower the rendering 
  3208. will be so you should use the lowest value that gives acceptable results.
  3209.  
  3210. The number of rays never exceeds the values you specify for rows and 
  3211. columns of points.  For example: area_light x,y,4,4 specifies a 4 by 4 
  3212. array of lights.  If you specify adaptive 3 it would mean that you should 
  3213. start with a 5 by 5 array.  In this case no adaptive sampling is done.  The 
  3214. 4 by 4 array is used.
  3215.  
  3216.  
  3217. 5.2.3.4     Looks_like
  3218.  
  3219. Normally the light source itself has no visible shape.  The light simply 
  3220. radiates from an invisible point or area.  You may give a light source a 
  3221. any shape by adding a "looks_like{OBJECT}" statement.  For example:
  3222.  
  3223.         light_source {
  3224.            <100,200,-300> color White
  3225.            looks_like {sphere{<0,0,0>,1 texture{T1}}
  3226.         }
  3227.  
  3228. This creates a visible sphere which is automatically translated to the 
  3229. light's location <100,200,-300> even though the sphere has <0,0,0> as its 
  3230. center.  There is an implied "no_shadow" also attached to the sphere so 
  3231. that light is not blocked by the sphere.  Without the automatic no_shadow, 
  3232. the light inside the sphere would not escape. The sphere would, in effect, 
  3233. cast a shadow over everything.
  3234.        
  3235. If you want the attached object to block light then you should attach it 
  3236. with a union and not a looks_like as follows:
  3237.  
  3238.         union {
  3239.           light_source {<100,200,-300> color White}
  3240.           object {My_Lamp_Shade}
  3241.         }
  3242.  
  3243. Presumably parts of the lamp shade are open to let SOME light out.
  3244.  
  3245.  
  3246. 5.3   OBJECT MODIFIERS
  3247. ----------------------
  3248.  
  3249. A variety of modifiers may be attached to objects.  Transformations such as 
  3250. translate, rotate and scale have already been discussed.  Textures are in a 
  3251. section of their own below.  Here are three other important modifiers: 
  3252. clipped_by, bounded_by and no_shadow.  Although the examples below use 
  3253. object statements and object identifiers, these modifiers may be used on 
  3254. any type of object such as sphere, box etc.
  3255.  
  3256.  
  3257. 5.3.1 CLIPPED_BY
  3258.    
  3259. The "clipped_by" statement is technically an object modifier but it 
  3260. provides a type of CSG similar to CSG intersection.  You attach a clipping 
  3261. object like this:
  3262.  
  3263.         object {
  3264.            My_Thing
  3265.            clipped_by{plane{y,0}}
  3266.         }
  3267.  
  3268. Every part of the object "My_Thing" that is inside the plane is retained 
  3269. while the remaining part is clipped off and discarded.  In an intersection 
  3270. object, the hole is closed off.  With clipped_by it leaves an opening.  For 
  3271. example this diagram shows our object "A" being clipped_by a plane{y,0}.
  3272.  
  3273.  
  3274.  
  3275.                        *       *
  3276.                       *         *
  3277.                      *           *
  3278.                     ***************
  3279.     
  3280. Clipped_by may be used to slice off portions of any shape. In many cases it 
  3281. will also result in faster rendering times than other methods of altering a 
  3282. shape.
  3283.  
  3284. Often you will want to use the clipped_by and bounded_by options with the 
  3285. same object.  The following shortcut saves typing and uses less memory.
  3286.  
  3287.         object {
  3288.            My_Thing
  3289.            bounded_by{box{<0,0,0>,<1,1,1>}}
  3290.            clipped_by{bounded_by}
  3291.         }
  3292.  
  3293. This tells POV-Ray to use the same box as a clip that was used as a bounds.
  3294.  
  3295.  
  3296. 5.3.1 BOUNDED_BY
  3297.  
  3298. The calculations necessary to test if a ray hits an object can be quite 
  3299. time consuming.  Each ray has to be tested against every object in the 
  3300. scene.  POV-Ray attempts so speed up the process by building a set of 
  3301. invisible boxes, called bounding slabs, which cluster the objects together.  
  3302. This way a ray that travels in one part of the scene doesn't have to be 
  3303. tested against objects in another far away part of the scene.  When large 
  3304. number objects are present the slabs are nested inside each other.  POV-Ray 
  3305. can use slabs on any finite object.  However infinite objects such as 
  3306. plane, quadric, quartic, cubic & poly cannot be automatically bound.  Also 
  3307. CSG objects cannot be efficiently bound by automatic methods.  By attaching 
  3308. a bounded_by statement to such shapes you can speed up the testing of the 
  3309. shape and make it capable of using bounding slabs.
  3310.  
  3311. If you use bounding shapes around any complex objects you can speed up the 
  3312. rendering. Bounding shapes tell the ray tracer that the object is totally 
  3313. enclosed by a simple shape. When tracing rays, the ray is first tested 
  3314. against the simple bounding shape. If it strikes the bounding shape, then 
  3315. the ray is further tested against the more complicated object inside. 
  3316. Otherwise the entire complex shape is skipped, which greatly speeds 
  3317. rendering.  
  3318.  
  3319. To use bounding shapes, simply include the following lines in the 
  3320. declaration of your object:
  3321.        
  3322.             bounded_by {
  3323.                  object { ... }
  3324.             }
  3325.        
  3326.        An example of a Bounding Shape:
  3327.        
  3328.             intersection {
  3329.                 sphere {<0,0,0>, 2}
  3330.                 plane  {<0,1,0>, 0}
  3331.                 plane  {<1,0,0>, 0}
  3332.                 bounded_by {sphere {<0,0,0>, 2}}
  3333.             }
  3334.        
  3335. The best bounding shape is a sphere or a box since these shapes are highly 
  3336. optimized, although, any shape may be used.  If the bounding shape is 
  3337. itself a finite shape which responds to bounding slabs then the object 
  3338. which it encloses will also be used in the slab system.
  3339.  
  3340. CSG shapes can benefit from bounding slabs without a bounded_by statement 
  3341. however they may do so inefficiently in intersection, difference and merge.  
  3342. In these three CSG types the automatic bound used covers all of the 
  3343. component objects in their entirety.  However the result of these 
  3344. intersections may result in a smaller object.  Compare the sizes of the 
  3345. illustrations for union and intersection in the CSG section above.  It is 
  3346. possible to draw a much smaller box around the intersection of A and B than 
  3347. the union of A and B yet the automatic bounds are the size of union{A B} 
  3348. regardless of the kind of CSG specified.
  3349.  
  3350. While it is almost always a good idea to manually add a bounded_by to 
  3351. intersection, difference and merge, it is often best to NOT bound a union.  
  3352. If a union has no bounded_by and no clipped_by then POV-Ray can internally 
  3353. split apart the components of a union and apply automatic bounding slabs to 
  3354. any of its finite parts.  Note that some utilities such as RAW2POV may be 
  3355. able to generate bounds more efficiently than POV-Ray's current system.  
  3356. However most unions you create yourself can be easily bounded by the 
  3357. automatic system.  For technical reasons POV-Ray cannot split a merge 
  3358. object.  It is probably best to hand bound a merge, especially if it is 
  3359. very complex.
  3360.  
  3361. Note that if bounding shape is too small or positioned incorrectly, it may 
  3362. clip the object in undefined ways or the object may not appear at all.  To 
  3363. do true clipping, use clipped_by as explained above. Often you will want to 
  3364. use the clipped_by and bounded_by options with the same object.  The 
  3365. following shortcut saves typing and uses less memory.
  3366.  
  3367.         object {
  3368.            My_Thing
  3369.            clipped_by{box{<0   Color
  3370.  
  3371. The simplest type of pigment is a solid color.  To specify a solid color 
  3372. you simply put a color specification inside a pigment.  For example...
  3373.  
  3374.   pigment {color Orange}
  3375.  
  3376. A color specification consists of the keyword "color" followed a color 
  3377. identifier or by a specification of the amount or red, green, blue and 
  3378. transparency in the surface.  For example:
  3379.  
  3380.   color red 0.5   green 0.2   blue 1.0
  3381.  
  3382. The float values between 0.0 and 1.0 are used to specify the intensity of 
  3383. each primary color of light.  Note that we use additive color primaries 
  3384. like the color phosphors on a color computer monitor or TV.  Thus...
  3385.  
  3386.   color red 1.0   green 1.0   blue 1.0 
  3387.  
  3388.  ...specifies full intensity of all primary colors which is white light.  
  3389. The primaries may be given in any order and if any primary is unspecified 
  3390. its value defaults to zero.
  3391.  
  3392. In addition to the primary colors a 4th value called "filter" specifies the 
  3393. amount of transparency.  For example a piece of red tinted cellophane might 
  3394. have...
  3395.  
  3396.   color red 1.0  filter 1.0
  3397.  
  3398. Lowering the filter value would let less light through.  The default value 
  3399. if no filter is specified is 0.0 or no transparency.  Note that the example 
  3400. has an implied "green 0.0  blue 0.0" which means that no green or blue 
  3401. light can pass through.  Often users mistakenly specify a clear object 
  3402. by...
  3403.  
  3404.   color filter 1.0
  3405.  
  3406. but this has implied red, green and blue values of zero.  You've just 
  3407. specified a totally black filter so no light passes through.  The correct 
  3408. way is...
  3409.  
  3410.   color red 1.0   green 1.0   blue 1.0   filter 1.0
  3411.  
  3412. Note in earlier versions of POV-Ray the keyword "alpha" was used for 
  3413. transparency.  However common usage of "alpha" in this context usually 
  3414. means that light passes through unaffected.  In POV-Ray however, light is 
  3415. filtered when it passes through a colored surface.  The program works the 
  3416. same as it always did but the keyword has been changed to make its meaning 
  3417. clearer.
  3418.  
  3419. A short-cut way to specify a color is...
  3420.  
  3421.   color rgb<0.2, 0.5, 0.9>
  3422.  
  3423.       or
  3424.  
  3425.   color rgbf<0.2, 0.8, 1.0, 0.7>
  3426.  
  3427. Color specifications are used elsewhere in POV-Ray.  Unless stated 
  3428. otherwise, all of the above information on color specs given above applies 
  3429. to any color spec.
  3430.  
  3431. Color identifiers may be declared.  For examples see COLORS.INC.  A color 
  3432. identifier contains red, blue, green and filter values even if they are not 
  3433. explicitly specified.  For example:
  3434.  
  3435.   color filter 1.0 My_Color // here My_Color overwrites the filter
  3436.  
  3437.   color My_Color filter 1.0 // this changes My_Color's filter value to 1.0
  3438.  
  3439. When using a color specification to give an object a solid color pigment, 
  3440. the keyword "color" may be omitted.  For example...
  3441.  
  3442.   pigment {red 1  blue 0.5}
  3443.         or
  3444.   pigment {My_Color}
  3445.  
  3446. are legal.
  3447.  
  3448.  
  3449. 5.4.1.2     Color List Patterns -- checker and hexagon
  3450.  
  3451. Two of the simplest color patterns available are the checker and hexagon 
  3452. patterns.  These patterns take a simple list of colors one after the other.  
  3453. For example a checker pattern is specified by...
  3454.  
  3455.   pigment {checker color C1  color C2}
  3456.  
  3457. This produces a checkered pattern consisting of alternating squares of 
  3458. color C1 and C2.  If no colors are specified then default blue and green 
  3459. colors are used.
  3460.  
  3461. All color patterns in POV-Ray are 3 dimensional.  For every x,y,z point in 
  3462. space, the pattern has a unique color.  In the case of a checker pattern it 
  3463. is actually a series of cubes that are one unit in size.  Imagine a bunch 
  3464. of 1 inch cubes made from two different colors of modeling clay.  Now 
  3465. imagine arranging the cubes in an alternating check pattern and stacking 
  3466. them in layer after layer so that the colors still alternated in every 
  3467. direction.  Eventually you would have a larger cube.  The pattern of checks 
  3468. on each side is what the POV-Ray checker pattern produces when applied to a 
  3469. box object.  Finally imagine cutting away at the cube until it is carved 
  3470. into a smooth sphere or any other shape.  This is what the checker pattern 
  3471. would look like on an object of any kind.
  3472.  
  3473. Color patterns do not wrap around the surfaces like putting wallpaper on an 
  3474. object.  The patterns exist in 3-d and the objects are carved from them 
  3475. like carving stacked colored cubes.  In a later section we describe wood 
  3476. and marble patterns for example.  The wood grain or stone swirls exist 
  3477. through the whole object but they appear only at the surface.
  3478.  
  3479. Another pattern that uses a list of colors is the hexagon pattern.  A 
  3480. hexagon pattern is specified by...
  3481.  
  3482.   pigment {hexagon color C1  color C2  color C3}
  3483.  
  3484. Hex pattern generates a repeating pattern of hexagons in the XZ plane.  In 
  3485. this instance imagine tall rods that are hexagonal in shape and are 
  3486. parallel to the Y axis and grouped in bundles like this...
  3487.  
  3488.            _____              
  3489.           /     \              
  3490.          /   C2  \_____             
  3491.         |\       /     \        
  3492.         | \_____/   C3  \
  3493.         | /     \       /|      
  3494.          /   C1  \_____/ |
  3495.         |\       /|    | |
  3496.         | \_____/ |    | |
  3497.         | |     | |    | |
  3498.         | |     | |    | |
  3499.         | |     | |    | |
  3500.         | |     | |    | |
  3501.         | |     | |    |
  3502.         | |     | |    |
  3503.           |     |
  3504.           |     |
  3505.  
  3506.  
  3507. The three colors will repeat the pattern shown above with hexagon C1 
  3508. centered at the origin.  Each side of the hexagon is one unit long.  The 
  3509. hexagonal "rods" of color extend infinitely in the +Y and -Y directions.  
  3510. If no colors are specified then default blue, green, and red colors are 
  3511. used.
  3512.  
  3513.  
  3514. 5.4.1.3     Color Mapped Patterns
  3515.  
  3516. Most of the color patterns do not use abrupt color changes of just two or 
  3517. three colors like those in the checker or hexagon patterns.  They instead 
  3518. use smooth transitions of many colors that gradually change from one point 
  3519. to the next.  The colors are defined in a color map that describes how the 
  3520. pattern blends from one color to the next.  
  3521.  
  3522.  
  3523. 5.4.1.3.1   Gradient 
  3524.  
  3525. This simplest such pattern is the "gradient" pattern.  It is specified as 
  3526. follows...
  3527.  
  3528.   pigment {gradient VECTOR}
  3529.  
  3530. where VECTOR is a vector pointing in the direction that the colors blend.  
  3531. For example:
  3532.  
  3533.       sphere {
  3534.         <0, 1, 2>, 2
  3535.         pigment { gradient x } // bands of color vary as you move
  3536.                                // along the "x" direction.
  3537.       }
  3538.  
  3539. This produces a series of smooth bands of color that look like layers of 
  3540. color next to each other.  Points at x=0 are black.  As the X location 
  3541. increases it smoothly turns to white at x=1.  Then it starts over with 
  3542. black and gradually turns white at x=2.  The pattern reverses for negative 
  3543. values of X.  Using "gradient y" or "gradient z" makes the colors blend 
  3544. along the y or z axis.  Any vector may be used but x, y and z are most 
  3545. common.
  3546.  
  3547.  
  3548. 5.4.1.3.2   Color Maps
  3549.  
  3550. The gray scale default colors of the gradient pattern isn't a very 
  3551. interesting sight.  The real power comes from specifying a color map to 
  3552. define how the colors should blend.
  3553.  
  3554. Each of the various pattern types available is in fact a mathematical 
  3555. function that takes any x,y,z location and turns it into a number between 
  3556. 0.0 and 1.0.  That number is used to specify what mix of colors to use from 
  3557. the color map.
  3558.  
  3559. A color map is specified by...
  3560.  
  3561.       color_map {
  3562.         [ NUM_1 color C1]
  3563.         [ NUM_2 color C2]
  3564.         [ NUM_3 color C3]
  3565.          ... 
  3566.         }
  3567.  
  3568. Where NUM_1, NUM_2... are float values between 0.0 and 1.0 inclusive.  C1, 
  3569. C2 ... are color specifications.  NOTE: the [] brackets are part of the 
  3570. actual statement.  They are not notational symbols denoting optional parts.  
  3571. The brackets surround each entry in the color map.  There may be from 2 to 
  3572. 20 entries in the map. 
  3573.  
  3574. For example,
  3575.  
  3576.       sphere {
  3577.         <0,1,2>, 2
  3578.         pigment { 
  3579.           gradient x 
  3580.           color_map {
  3581.             [0.1  color Red]
  3582.             [0.3  color Yellow]
  3583.             [0.6  color Blue]
  3584.             [0.6  color Green]
  3585.             [0.8  color Cyan]
  3586.           }
  3587.         }
  3588.       }
  3589.  
  3590. The pattern function is evaluated and the result is a value from 0.0 to 
  3591. 1.0.  If the value is less than the first entry (in this case 0.1) then the 
  3592. first color (Red) is used.  Values from 0.1 to 0.3 use a blend of red and 
  3593. yellow using linear interpolation of the two colors.  Similarly values from 
  3594. 0.3 to 0.6 blend from yellow to blue.  Note that the 3rd and 4th entries 
  3595. both have values of 0.6.  This causes an immediate abrupt shift of color 
  3596. from blue to green.  Specifically a value that is less than 0.6 will be 
  3597. blue but exactly equal to 0.6 will be green.  Moving along, values from 0.6 
  3598. to 0.8 will be a blend of green and cyan.  Finally any value greater than 
  3599. or equal to 0.8 will be cyan.
  3600.  
  3601. If you want areas of unchanging color you simply specify the same color for 
  3602. two adjacent entries.  For example:
  3603.  
  3604.       color_map {
  3605.         [0.1  color Red]
  3606.         [0.3  color Yellow]
  3607.         [0.6  color Yellow]
  3608.         [0.8  color Green]
  3609.       }
  3610.  
  3611. In this case any value from 0.3 to 0.6 will be pure yellow.
  3612.  
  3613.  
  3614. 5.4.1.3.3   Marble
  3615.  
  3616. A "gradient x" pattern uses colors from the color map from 0.0 up to 1.0 at 
  3617. location x=1 but then jumps back to the first color for x=1.00000001 (or 
  3618. some tiny fraction above 1.0) and repeats the pattern again and again.  The 
  3619. marble pattern is similar except that it uses the color map from 0 to 1 but 
  3620. then it reverses the map and blends from 1 back to zero.  For example:
  3621.  
  3622.       pigment { 
  3623.         gradient x 
  3624.         color_map {
  3625.           [0.0  color Yellow]
  3626.           [1.0  color Cyan]
  3627.         }
  3628.       }
  3629.  
  3630. This blends from yellow to cyan and then it abruptly changes back to yellow 
  3631. and repeats.  However replacing "gradient x" with "marble" smoothly blends 
  3632. from yellow to cyan as the x coordinate goes from 0.0 to 0.5 and then 
  3633. smoothly blends back from cyan to yellow by x=1.0.
  3634.  
  3635. When used with a "turbulence" modifier and an appropriate color map, this 
  3636. pattern looks like veins of color of real marble, jade or other types of 
  3637. stone. By default, marble has no turbulence.
  3638.  
  3639.  
  3640. 5.4.1.3.4   Wood
  3641.  
  3642. Wood uses the color map to create concentric cylindrical bands of color 
  3643. centered on the Z axis.  These bands look like the growth rings and veins 
  3644. in real wood.  Small amounts of turbulence should be added to make it look 
  3645. more realistic. By default, wood has no turbulence.
  3646.  
  3647. Like marble, wood uses color map values 0 to 1 then repeats the colors in 
  3648. reverse order from 1 to 0.
  3649.  
  3650.  
  3651. 5.4.1.3.5   Onion
  3652.  
  3653. Onion is a pattern of concentric spheres like the layers of an onion.  It 
  3654. uses colors from a color map from 0 to 1, 0 to 1 etc without reversing.
  3655.  
  3656.  
  3657. 5.4.1.3.6   Leopard 
  3658.  
  3659. Leopard creates regular geometric pattern of circular spots.  It uses 
  3660. colors from a color map from 0 to 1, 0 to 1 etc without reversing.
  3661.  
  3662.  
  3663. 5.4.1.3.7   Granite 
  3664.  
  3665. This pattern uses a simple 1/f fractal noise function to give a pretty darn 
  3666. good granite pattern. Typically used with small scaling values (2.0 to 
  3667. 5.0).  This pattern is used with creative color maps in STONES.INC to 
  3668. create some gorgeous layered stone textures. By default, granite has no 
  3669. turbulence.  It uses colors from a color map from 0 to 1, 0 to 1 etc 
  3670. without reversing.
  3671.  
  3672.  
  3673. 5.4.1.3.8   Bozo 
  3674.  
  3675. The bozo color pattern takes a noise function and maps it onto the surface 
  3676. of an object. It uses colors from a color map from 0 to 1, 0 to 1 etc 
  3677. without reversing.
  3678.  
  3679. Noise in ray tracing is sort of like a random number generator, but it has 
  3680. the following properties:
  3681.  
  3682.   1) It's defined over 3D space i.e., it takes x, y, and z and returns the 
  3683. noise value there.
  3684.   2) If two points are far apart, the noise values at those points are 
  3685. relatively random.
  3686.   3) If two points are close together, the noise values at those points are 
  3687. close to each other.
  3688.  
  3689. You can visualize this as having a large room and a thermometer that ranges 
  3690. from 0.0 to 1.0. Each point in the room has a temperature. Points that are 
  3691. far apart have relatively random temperatures. Points that are close 
  3692. together have close temperatures. The temperature changes smoothly, but 
  3693. randomly as we move through the room. 
  3694.  
  3695. Now, let's place an object into this room along with an artist. The artist 
  3696. measures the temperature at each point on the object and paints that point 
  3697. a different color depending on the temperature. What do we get? A POV-Ray 
  3698. bozo texture!
  3699.  
  3700.  
  3701. 5.4.1.3.9   Spotted 
  3702.  
  3703. This uses the same noise pattern as bozo but it is unaffected by 
  3704. turbulence.  It uses colors from a color map from 0 to 1, 0 to 1 etc 
  3705. without reversing.
  3706.  
  3707.  
  3708. 5.4.1.3.10  Agate 
  3709.  
  3710. This pattern is very beautiful and similar to marble, but uses a different 
  3711. turbulence function. The turbulence keyword has no effect, and as such it 
  3712. is always very turbulent. You may control the amount of the built-in 
  3713. turbulence by adding the "agate_turb" keyword followed by a float value.  
  3714. For example:
  3715.  
  3716.       pigment { 
  3717.         agate
  3718.         agate_turb 0.5
  3719.         color_map {
  3720.           ...
  3721.         }
  3722.       }
  3723.  
  3724.  
  3725. 5.4.1.3.11  Mandel
  3726.  
  3727. The mandel pattern computes the standard Mandelbrot fractal pattern and 
  3728. projects it onto the X-Y plane.  It uses the X and Y coordinates to compute 
  3729. the Mandelbrot set.  The pattern is specified with the keyword mandel 
  3730. followed by an integer number.  This number is the maximum number of 
  3731. iterations to be used to compute the set.  Typical values range from 10 up 
  3732. to 256 but any positive integer may be used.  For example:
  3733.  
  3734.       sphere { 
  3735.        <0, 0, 0>, 1 
  3736.        pigment {
  3737.          mandel 25
  3738.          color_map {
  3739.            [0.0  color Cyan]
  3740.            [0.3  color Yellow]
  3741.            [0.6  color Magenta]
  3742.            [1.0  color Cyan]
  3743.          }
  3744.          scale .5
  3745.        }
  3746.       }
  3747.  
  3748. The value passed to the color map is computed by the formula:
  3749.  
  3750.     value = number_of_iterations / max_iterations
  3751.  
  3752. The color extends infinitely in the Z direction similar to a planar image 
  3753. map.  
  3754.  
  3755.  
  3756. 5.4.1.3.12  Radial
  3757.  
  3758. The radial pattern is a radial blend that wraps around the +Y axis.  The 
  3759. color for value 0.0 starts at the +X direction and wraps the color map 
  3760. around from east to west with 0.25 in the -Z direction, 0.5 in -X, 0.75 at 
  3761. +Z and back to 1.0 at +X.  See the "frequency" and "phase" pigment 
  3762. modifiers below for examples.
  3763.  
  3764.  
  3765. 5.4.1.4     Image Maps
  3766.  
  3767. When all else fails and none of the above pigment pattern types meets your 
  3768. needs, you can use an image map to wrap a 2-D bit-mapped image around your 
  3769. 3-D objects.
  3770.  
  3771.  
  3772. 5.4.1.4.1   Specifying an image map.
  3773.  
  3774. The syntax for image_map is...
  3775.  
  3776.   pigment {
  3777.     image_map {
  3778.       FILE_TYPE "filename"
  3779.       MODIFIERS...
  3780.     }
  3781.   }
  3782.  
  3783. Where FILE_TYPE is one of the following keywords "gif", "tga", "iff" or 
  3784. "dump".  This is followed by the name of the file in quotes.  Several 
  3785. optional modifiers may follow the file specification.  The modifiers are 
  3786. described below.  Note: Earlier versions of POV-Ray allowed some modifiers 
  3787. before the FILE_TYPE but that syntax is being phased out in favor of the 
  3788. syntax described here.
  3789.  
  3790. Filenames specified in the image_map statements will be searched for in the 
  3791. home (current) directory first, and if not found, will then be searched for 
  3792. in directories specified by any "-L" (library path) options active. This 
  3793. would facilitate keeping all your image maps files in a separate 
  3794. subdirectory, and giving an "-L" option on the command line to where your 
  3795. library of image maps are. 
  3796.  
  3797. By default, the image is mapped onto the X-Y plane.  The image is 
  3798. "projected" onto the object as though there were a slide projector 
  3799. somewhere in the -Z direction.  The image exactly fills the square area 
  3800. from x,y coordinates (0,0) to (1,1) regardless of the image's original size 
  3801. in pixels.  If you would like to change this default, you may translate, 
  3802. rotate or scale the pigment or texture to map it onto the object's surface 
  3803. as desired. 
  3804.  
  3805. In the section 5.4.1.2 above when we explained checker pigment patterns, we 
  3806. described the checks as solid cubes of colored clay from which objects are 
  3807. carved.  With image maps you should imagine that each pixel is a long, 
  3808. thin, square, colored rod that extends parallel to the Z axis.  The image 
  3809. is made from rows and columns of these rods bundled together and the object 
  3810. is then carved from the bundle.
  3811.  
  3812. If you would like to change this default orientation, you may translate, 
  3813. rotate or scale the pigment or texture to map it onto the object's surface 
  3814. as desired. 
  3815.  
  3816.  
  3817. 5.4.1.4.2   The "once" option.
  3818.  
  3819. Normally there are an infinite number of repeating images created over 
  3820. every unit square of the X-Y plane like tiles.  By adding the keyword 
  3821. "once" after a file name, you can eliminate all other copies of the image 
  3822. except the one at (0,0) to (1,1).  Areas outside this unit square are 
  3823. treated as fully transparent.
  3824.  
  3825. Note: The "once" keyword may also be used with bump_map and material_map 
  3826. statements.
  3827.  
  3828.  
  3829. 5.4.1.4.3   The "map_type" option.
  3830.  
  3831. The default projection of the image onto the X-Y plane is called a "planar 
  3832. map type".  This option may be changed by adding the "map_type" keyword 
  3833. followed by a number specifying the way to wrap the image around the 
  3834. object.
  3835.  
  3836. A "map_type 0" gives the default planar mapping already described.
  3837.  
  3838. A "map_type 1" is a spherical mapping.  It assumes that the object is a 
  3839. sphere of any size sitting at the origin.  The Y axis is the north/south 
  3840. pole of the spherical mapping.  The top and bottom edges of the image just 
  3841. touch the pole regardless of any scaling.  The left edge of the image 
  3842. begins at the positive X axis and wraps the image around the sphere from 
  3843. "west" to "east" in a -Y rotation.  The image covers the sphere exactly 
  3844. once.  The "once" keyword has no meaning for this type.
  3845.  
  3846. With "map_type 2" you get a cylindrical mapping.  It assumes that a 
  3847. cylinder of any diameter lies along the Y axis.  The image wraps around the 
  3848. cylinder just like the spherical map but the image remains 1 unit tall from 
  3849. y=0 to y=1.  This band of color is repeated at all heights unless the 
  3850. "once" keyword is applied.
  3851.  
  3852. Finally "map_type 5" is a torus or donut shaped mapping.  It assumes that a 
  3853. torus of major radius 1 sits at the origin in the X-Z plane.  The image is 
  3854. wrapped around similar to spherical or cylindrical maps.  However the top 
  3855. and bottom edges of the map wrap over and under the torus where they meet 
  3856. each other on the inner rim.
  3857.  
  3858. Types 3 and 4 are still under development.
  3859.  
  3860. Note: The "map_type" option may also be applied to bump_map and 
  3861. material_map statements.
  3862.  
  3863.  
  3864. 5.4.1.4.4   The "filter" options.
  3865.  
  3866. To make all or part of an image map transparent, you can specify filter 
  3867. values for the color palette/registers of GIF or IFF pictures (at least for 
  3868. the modes that use palettes/color maps). You can do this by adding the 
  3869. keyword "filter" following the filename.  The keyword is followed by two 
  3870. numbers.  The first number is the palette/register number value and 2nd is 
  3871. the amount of transparency. The values should be separated by a comma.  For 
  3872. example:
  3873.  
  3874.    image_map { 
  3875.      gif "mypic.gif"
  3876.      map_type 0 
  3877.      filter 0, 0.5 // Make color 0 50% transparent
  3878.      filter 5, 1.0 // Make color 5 100% transparent
  3879.      filter 8, 0.3 // Make color 8 30% transparent
  3880.     }
  3881.  
  3882. You can give the entire image a filter value using "filter all VALUE".  For 
  3883. example:
  3884.  
  3885.    image_map { 
  3886.      gif "stnglass.gif"
  3887.      map_type 0 
  3888.      filter all 0.9
  3889.     }
  3890.  
  3891. NOTE: Transparency works by filtering light by its original color.  Adding 
  3892. "filter" to the color black still leaves you with black no matter how high 
  3893. the filter value is. If you want a color to be clear, add filter 1 to the 
  3894. color white.
  3895.  
  3896.  
  3897. 5.4.1.4.5   The "interpolate" option.
  3898.  
  3899. Adding the "interpolate" keyword can smooths the jagged look of an image or 
  3900. bump map.  When POV-Ray asks a color or bump amount for an image or bump 
  3901. map, it often asks for a point that is not directly on top of one pixel, 
  3902. but sort of between several different colored pixels.  Interpolations 
  3903. returns an "in-between" value so that the steps between the pixels in the 
  3904. image or bump map will look smoother.
  3905.  
  3906. There are currently two types of interpolation:
  3907.  
  3908.    Normalized Distance -- interpolate 4
  3909.    Bilinear            -- interpolate 2
  3910.  
  3911. Default is no interpolation. Normalized distance is the slightly faster of 
  3912. the two, bilinear does a better job of picking the between color. Normally, 
  3913. bilinear is used.
  3914.  
  3915. If your bump or image map looks jaggy, try using interpolation instead of 
  3916. going to a higher resolution image.  The results can be very good.  For 
  3917. example:
  3918.  
  3919.    image_map { 
  3920.      gif "mypic.gif"
  3921.      map_type 0 
  3922.      interpolate 2
  3923.     }
  3924.  
  3925.  
  3926. 5.4.1.5     Pigment Modifiers
  3927.  
  3928. After specifying the pigment type such as marble, wood etc and adding an 
  3929. optional color map, you may add any of several modifiers.
  3930.  
  3931.  
  3932. 5.4.1.5.1   Turbulence
  3933.  
  3934. The keyword "turbulence" followed by a float or vector may be used to stir 
  3935. up the color pattern.  Typical values range from the default 0.0 which is 
  3936. no turbulence to 1.0 which is very turbulent.  If a vector is specified 
  3937. then different amounts of turbulence are applied in the x, y and z 
  3938. directions.  For example "turbulence <1.0, 0.6, 0.1>" has much turbulence 
  3939. in the x direction, a moderate amount in the y direction and a small amount 
  3940. in the z direction.
  3941.  
  3942. Turbulence uses a noise function called DNoise.  This is sort of like noise 
  3943. used in the bozo pattern except that instead of giving a single value it 
  3944. gives a direction. You can think of it as the direction that the wind is 
  3945. blowing at that spot.
  3946.  
  3947. Turbulence which uses DNoise to push a point around a few times.  We locate 
  3948. the point we want to color (P), then push it around a bit using turbulence 
  3949. to get to a final point (Q) then look up the color of point Q in our 
  3950. ordinary boring textures. That's the color that's used for the point P.
  3951.  
  3952. It in effect says "Don't give me the color at this spot... take a few 
  3953. random steps in a different direction and give me that color.  Each step is 
  3954. typically half as long as the one before.  For example:
  3955.  
  3956.          P ------------------------->
  3957.                   First Move        /
  3958.                                    /
  3959.                                   /
  3960.                                  /Second
  3961.                                 /  Move
  3962.                                /
  3963.                         ______/
  3964.                         \
  3965.                          \
  3966.                           Q - Final point.
  3967.  
  3968.  
  3969. The magnitude of these steps is controlled by the turbulence value.
  3970.  
  3971.  
  3972. 5.4.1.5.2   Octaves
  3973.  
  3974. The number of steps used by turbulence is controlled by the "octaves" 
  3975. value.  The values may range from 1 up to 10.  The default value of 
  3976. "octaves 6" is fairly close to the upper limit; you won't see much change 
  3977. by setting it to a higher value because the extra steps are too small.  You 
  3978. can achieve some very interesting wavy effects by specifying lower values. 
  3979. Setting octaves higher can slow down rendering because more steps are 
  3980. computed.
  3981.  
  3982.  
  3983. 5.4.1.5.3   Omega
  3984.  
  3985. The keyword "omega" followed by a float value may be added to change the 
  3986. turbulence calculations.  Each successive octave of turbulence is 
  3987. multiplied by the omega value. The default "omega 0.5" means that each 
  3988. octave is 1/2 the size of the previous one.  Higher omega values mean that 
  3989. 2nd, 3rd, 4th and up octaves contribute more turbulence giving a sharper, 
  3990. "krinkly" look while smaller omegas give a fuzzy kind of turbulence that 
  3991. gets blury in places.
  3992.  
  3993.  
  3994. 5.4.1.5.4   Lambda
  3995.  
  3996. The lambda parameter controls how statistically different the random move 
  3997. of an octave is compared to its previous octave.  The default value for 
  3998. this is "lambda 2".  Values close to lambda 1.0 will straighten out the 
  3999. randomness of the path in the diagram above.  Higher values can look more 
  4000. "swirly" under some circumstances.  More tinkering by POV-Ray users may 
  4001. lead us to discover ways to make good use of this parameter.  For now just 
  4002. tinker and enjoy.
  4003.  
  4004.  
  4005. 5.4.1.5.5   Quick_color
  4006.  
  4007. When developing POV-Ray scenes its often useful to do low quality test runs 
  4008. that render faster.  The +Q command line switch can be used to turn off 
  4009. some time consuming color pattern and lighting calculations to speed things 
  4010. up.  However all settings of +Q5 or lower turns off pigment calculations 
  4011. and creates gray objects.
  4012.  
  4013. By adding a "quick_color" to a pigment you tell POV-Ray what solid color to 
  4014. use for quick renders instead of a patterned pigment.  For example:
  4015.  
  4016.    pigment {
  4017.      gradient x
  4018.      color_map{
  4019.        [0 color Yellow][0.3 color Cyan][0.6 color Magenta][1 color Cyan]
  4020.      }
  4021.      turbulence 0.5  lambda 1.5  omega 0.75  octaves 8
  4022.      quick_color Neon_Pink
  4023.    }
  4024.  
  4025. This tells POV-Ray to use solid Neon_Pink for test runs at quality +Q5 or 
  4026. lower but to use the turbulent gradient pattern for rendering at +Q6 and 
  4027. higher.
  4028.  
  4029. Note that solid color pigments such as:
  4030.  
  4031.    pigment {color Magenta}
  4032.  
  4033. automatically set the quick_color to that value.  You may override this if 
  4034. you want.  Suppose you have 10 spheres on the screen and all are Yellow.  
  4035. If you want to identify them individually you could give each a different 
  4036. quick_color like this:
  4037.  
  4038.    sphere {<1,2,3>,4 pigment {color Yellow  quick_color Red}}
  4039.  
  4040.    sphere {<-1,-2,-3>,4 pigment {color Yellow  quick_color Blue}}
  4041.  
  4042.  ...and so on.  At +Q6 or higher they will all be Yellow but at +Q5 or 
  4043. lower each would be different colors so you could identify them.
  4044.  
  4045.  
  4046. 5.4.1.5.6   Frequency and Phase
  4047.  
  4048. The frequency and phase keywords were originally intended for the normal 
  4049. patterns ripples and waves discussed in the next section.  With version 2.0 
  4050. they were extended to pigments to make the radial and mandel pigment 
  4051. pattern easier to use.  As it turned out it was simple to make them apply 
  4052. to any color map pattern.
  4053.  
  4054. The frequency keyword adjusts the number of times that a color map repeats 
  4055. over one cycle of a pattern.  For example gradient x covers color map 
  4056. values 0 to 1 over the range x=0 to x=1.  By adding "frequency 2" the color 
  4057. map repeats twice over that same range.  The same effect can be achieved 
  4058. using "scale x*0.5" so the frequency keyword isn't that useful for patterns 
  4059. like gradient. 
  4060.  
  4061. However the radial pattern wraps the color map around the +Y axis once.  If 
  4062. you wanted two copies of the map (or 3 or 10 or 100) you'd have to build a 
  4063. bigger map.  Adding "frequency 2" causes the color map to be used twice per 
  4064. revolution.  Try this:
  4065.  
  4066.       sphere {<0,0,0>,3
  4067.         pigment { 
  4068.           radial
  4069.           color_map{[0.5 color Red][0.5 color White]}
  4070.           frequency 6
  4071.         }
  4072.         rotate -x*90
  4073.       }
  4074.  
  4075. The result is 6 sets of red and white radial stripes evenly spaced around 
  4076. the sphere.
  4077.  
  4078. Note "frequency -1" reverses the entries in a color_map.
  4079.  
  4080. The phase keyword takes values from 0.0 to 1.0 and rotates the color map 
  4081. entries.  In the example above if you render successive frames at phase 0 
  4082. then phase 0.1, phase 0.2 etc you could create an animation that rotates 
  4083. the stripes.  The same effect can be easily achieved by rotating the radial 
  4084. pigment using "rotate y*Angle" but there are other uses where phase can be 
  4085. handy.  
  4086.  
  4087. Sometimes you create a great looking gradient or wood color map but you 
  4088. want the grain slightly adjusted in or out.  You could re-order the color 
  4089. map entries but that's a pain.  A phase adjustment will shift everything 
  4090. but keep the same scale.  Try animating a mandel pigment for a color 
  4091. palette rotation effect.
  4092.  
  4093.  
  4094. 5.4.1.5.7   Transforming pigments
  4095.  
  4096. You may modify pigment patterns with "translate", "rotate" and "scale" 
  4097. commands.  Note that placing these transforms inside the texture but 
  4098. outside the pigment will transform the entire texture.  However placing 
  4099. them inside the pigment transforms just the pigment.  For example:
  4100.  
  4101.       sphere {<0,0,0>,3
  4102.         texture {
  4103.           pigment { 
  4104.             checker color Red color White
  4105.             scale <2,1,3>  // affects pigment only... not normal
  4106.           }
  4107.           normal {
  4108.             bumps 0.3
  4109.             scale 0.4      // affects bump normal only... not pigment
  4110.           }
  4111.           finish {Shiny}
  4112.           translate 5*x    // affects entire texture
  4113.         }
  4114.         translate y*2      // affects object and texture
  4115.       }
  4116.  
  4117. Note that transforms affect the entire pigment regardless of the ordering 
  4118. of other parameters.  For example:
  4119.  
  4120.   This...                         ...is the same as this...
  4121.  
  4122.      pigment {                          pigment {                    
  4123.        bozo                               bozo                       
  4124.        turbulence 0.3                     scale 2                              
  4125.        scale 2                            turbulence 0.3   
  4126.      }                                  }                            
  4127.  
  4128. The scaling before or after turbulence makes no difference.  In general it 
  4129. is best to put all transformations last for the sake of clarity.
  4130.  
  4131.  
  4132. 5.4.2 NORMAL
  4133.  
  4134. Ray tracing is known for the dramatic way it depicts reflection, refraction 
  4135. and lighting effects.  Much of our perception depends on the reflective 
  4136. properties of an object.  Ray tracing can exploit this by playing tricks on 
  4137. our perception to make us see complex details that aren't really there.
  4138.  
  4139. Suppose you wanted a very bumpy surface on the object.  It would be very 
  4140. difficult to mathematically model lots of bumps.  We can however simulate 
  4141. the way bumps look by altering the way light reflects off of the surface.  
  4142. Reflection calculations depend on a vector called a "surface normal" 
  4143. vector.  This is a vector which points away from the surface and is 
  4144. perpendicular to it.  By artificially modifying (or perturbing) this normal 
  4145. vector you can simulate bumps.  
  4146.  
  4147. The "normal {...}" statement is the part of a texture which defines the 
  4148. pattern of normal perturbations to be applied to an object.  Like the 
  4149. pigment statement, you can omit the surrounding texture block to save 
  4150. typing.  Do not forget however that there is a texture implied. For 
  4151. example...
  4152.  
  4153.  this...                        can be shortened to this...
  4154.  
  4155.   object {                           object {                   
  4156.     My_Object                          My_Object                
  4157.     texture {                          pigment {color Purple} 
  4158.       pigment {color Purple}           normal {bumps 0.3}                        
  4159.       normal {bumps 0.3}             }
  4160.     }                                  
  4161.   }                                                           
  4162.  
  4163. Note that attaching a normal pattern does not really modify the surface.  
  4164. It only affects the way light reflects or refracts at the surface so that 
  4165. it looks bumpy.
  4166.  
  4167. The most complete form for defining a normal is as follows:
  4168.  
  4169.   normal {
  4170.     NORMAL_IDENTIFIER
  4171.     NORMAL_PATTERN_TYPE
  4172.     NORMAL_MODIFIERS
  4173.     TRANSFORMATIONS...
  4174.   }
  4175.  
  4176. Each of the items in a normal are optional but if they are present, they 
  4177. should be in the order shown above to insure that the results are as 
  4178. expected.  Any items after the NORMAL_IDENTIFIER modify or override 
  4179. settings given in the IDENTIFIER.  If no identifier is specified then the 
  4180. items modify the normal values in the current default texture.  
  4181. TRANSFORMATIONs are translate, rotate and scale statements.  They apply 
  4182. only to the normal and not to other parts of the texture.  They should be 
  4183. specified last.
  4184.  
  4185. There are 6 different NORMAL_PATTERN_TYPEs discussed below.  They are 
  4186. bumps, dents, ripples, waves, wrinkles and bump_map.  
  4187.  
  4188.  
  4189. 5.4.2.1     Bumps
  4190.  
  4191. A smoothly rolling random pattern of bumps can be created with the "bumps" 
  4192. normal pattern.  Bumps uses the same random noise function as the bozo and 
  4193. spotted pigment patterns, but uses the derived value to perturb the surface 
  4194. normal or, in other words, make the surface look bumpy. This gives the 
  4195. impression of a "bumpy" surface, random and irregular, sort of like an 
  4196. orange. 
  4197.  
  4198. After the bumps keyword, you supply a single floating point value for the 
  4199. amount of surface perturbation.  Values typically range from 0.0 (No Bumps) 
  4200. to 1.0 or greater (Extremely Bumpy). For example:
  4201.  
  4202.       sphere {
  4203.         <0, 1, 2>, 2
  4204.         texture {
  4205.           pigment {color Yellow}  
  4206.           normal {bumps 0.4   scale 0.2}
  4207.           finish {phong 1}
  4208.         }
  4209.       }
  4210.  
  4211. This tells POV-Ray to use a bump pattern to modify the surface normal.  The 
  4212. value 0.4 controls the apparent depth of the bumps.  Usually the bumps are 
  4213. about 1 unit wide which doesn't work very well with a sphere of radius 2.  
  4214. The scale makes the bumps 1/5th as wide but does not affect their depth. 
  4215.  
  4216.  
  4217. 5.4.2.2     Dents
  4218.  
  4219. The "dents" pattern is especially interesting when used with metallic 
  4220. textures, it gives impressions into the metal surface that look like dents 
  4221. have been beaten into the surface with a hammer. A single value is supplied 
  4222. after the dents keyword to indicate the amount of denting required. Values 
  4223. range from 0.0 (Showroom New) to 1.0 (Insurance Wreck). Scale the pattern 
  4224. to make the pitting more or less frequent.
  4225.  
  4226.  
  4227. 5.4.2.3     Ripples
  4228.  
  4229. The ripples bump pattern make a surface look like ripples of water. The 
  4230. ripples option requires a value to determine how deep the ripples are.  
  4231. Values range from 0.0 to 1.0 or more.  The ripples radiate from 10 random 
  4232. locations inside the unit cube area <0,0,0> to <1,1,1>.  Scale the pattern 
  4233. to make the centers closer or farther apart.  
  4234.  
  4235. The frequency keyword changes the spacing between ripples.  The phase 
  4236. keyword can be used to move the ripples outwards for realistic animation.
  4237.  
  4238.  
  4239. 5.4.2.4     Waves
  4240.  
  4241. This works in a similar way to ripples except that it makes waves with 
  4242. different frequencies. The effect is to make waves that look more like deep 
  4243. ocean waves.  The waves option requires a value to determine how deep the 
  4244. waves are.  Values range from 0.0 to 1.0 or more.  The waves radiate from 
  4245. 10 random locations inside the unit cube area <0,0,0> to <1,1,1>.  Scale 
  4246. the pattern to make the centers closer or farther apart.  
  4247.  
  4248. The frequency keyword changes the spacing between waves.  The phase keyword 
  4249. can be used to move the waves outwards for realistic animation.
  4250.  
  4251.  
  4252. 5.4.2.5     Wrinkles
  4253.  
  4254. This is sort of a 3-D bumpy granite. It uses a similar 1/f fractal noise 
  4255. function to perturb the surface normal in 3-D space. With a transparent 
  4256. color pattern, could look like wrinkled cellophane. Requires a single value 
  4257. after the wrinkles keyword to indicate the amount of wrinkling desired. 
  4258. Values from 0.0 (No Wrinkles) to 1.0 (Very Wrinkled) are typical. 
  4259.  
  4260.  
  4261. 5.4.2.6     Bump_map
  4262.  
  4263. When all else fails and none of the above normal pattern types meets your 
  4264. needs, you can use a bump map to wrap a 2-D bit-mapped bump pattern around 
  4265. your 3-D objects.
  4266.  
  4267. Instead of placing the color of the image on the shape like an image_map, 
  4268. bump_map perturbs the surface normal based on the color of the image at 
  4269. that point. The result looks like the image has been embossed into the 
  4270. surface.  By default, bump_map uses the brightness of the actual color of 
  4271. the pixel. Colors are converted to gray scale internally before calculating 
  4272. height.  Black is a low spot, white is a high spot. The image's index 
  4273. values may be used instead (see use_index) below.  
  4274.  
  4275.  
  4276. 5.4.2.6.1   Specifying a bump map.
  4277.  
  4278. The syntax for bump_map is...
  4279.  
  4280.   normal {
  4281.     bump_map {
  4282.       FILE_TYPE "filename"
  4283.       MODIFIERS...
  4284.     }
  4285.   }
  4286.  
  4287. Where FILE_TYPE is one of the following keywords "gif", "tga", "iff" or 
  4288. "dump".  This is followed by the name of the file in quotes.  Several 
  4289. optional modifiers may follow the file specification.  The modifiers are 
  4290. described below.  Note: Earlier versions of POV-Ray allowed some modifiers 
  4291. before the FILE_TYPE but that syntax is being phased out in favor of the 
  4292. syntax described here.
  4293.  
  4294. Filenames specified in the bump_map statements will be searched for in the 
  4295. home (current) directory first, and if not found, will then be searched for 
  4296. in directories specified by any "-L" (library path) options active. This 
  4297. would facilitate keeping all your bump maps files in a separate 
  4298. subdirectory, and giving an "-L" option on the command line to where your 
  4299. library of bump maps are. 
  4300.  
  4301. By default, the bump is mapped onto the X-Y plane.  The bump is "projected" 
  4302. onto the object as though there were a slide projector somewhere in the -Z 
  4303. direction.  The bump exactly fills the square area from x,y coordinates 
  4304. (0,0) to (1,1) regardless of the bump's original size in pixels.  If you 
  4305. would like to change this default, you may translate, rotate or scale the 
  4306. normal or texture to map it onto the object's surface as desired. 
  4307.  
  4308. If you would like to change this default orientation, you may translate, 
  4309. rotate or scale the normal or texture to map it onto the object's surface 
  4310. as desired. 
  4311.  
  4312.  
  4313. 5.4.2.6.2   Bump_size
  4314.  
  4315. The relative bump_size can be scaled using bump_size modifier. The 
  4316. bump_size number can be any number other than 0. Valid numbers are 2, .5, 
  4317. -33, 1000, etc. For example:
  4318.  
  4319.   normal {
  4320.     bump_map { 
  4321.       gif "stuff.gif" 
  4322.       bump_size 5
  4323.     }
  4324.   }
  4325.  
  4326.  
  4327. 5.4.2.6.3   Use_index & use_color
  4328.  
  4329. Usually the bump_map converts the color of the pixel in the map to a 
  4330. grayscale intensity value in the range 0.0 to 1.0 and calculates the bumps 
  4331. based on that value.  If you specify use_index, bump_map uses the color's 
  4332. palette number to compute as the height of the bump at that point. So, 
  4333. color #0 would be low and color #255 would be high. The actual color of the 
  4334. pixels doesn't matter when using the index.  The "use_color" keyword may be 
  4335. specified to explicitly note that the color methods should be used instead.
  4336.  
  4337.  
  4338. 5.4.2.6.4   The "once" option.
  4339.  
  4340. Normally there are an infinite number of repeating bump_maps created over 
  4341. every unit square of the X-Y plane like tiles.  By adding the keyword 
  4342. "once" after a file name, you can eliminate all other copies of the 
  4343. bump_map except the one at (0,0) to (1,1).  Areas outside this unit square 
  4344. are treated as fully transparent.
  4345.  
  4346. Note: The "once" keyword may also be used with image_map and material_map 
  4347. statements.
  4348.  
  4349.  
  4350. 5.4.2.6.5   The "map_type" option.
  4351.  
  4352. The default projection of the bump onto the X-Y plane is called a "planar 
  4353. map type".  This option may be changed by adding the "map_type" keyword 
  4354. followed by a number specifying the way to wrap the bump around the object.
  4355.  
  4356. A "map_type 0" gives the default planar mapping already described.
  4357.  
  4358. A "map_type 1" is a spherical mapping.  It assumes that the object is a 
  4359. sphere of any size sitting at the origin.  The Y axis is the north/south 
  4360. pole of the spherical mapping.  The top and bottom edges of the bump_map 
  4361. just touch the pole regardless of any scaling.  The left edge of the 
  4362. bump_map begins at the positive X axis and wraps the pattern around the 
  4363. sphere from "west" to "east" in a -Y rotation.  The pattern covers the 
  4364. sphere exactly once.  The "once" keyword has no meaning for this type.
  4365.  
  4366. With "map_type 2" you get a cylindrical mapping.  It assumes that a 
  4367. cylinder of any diameter lies along the Y axis.  The bump pattern wraps 
  4368. around the cylinder just like the spherical map but remains 1 unit tall 
  4369. from y=0 to y=1.  This band of bumps is repeated at all heights unless the 
  4370. "once" keyword is applied.
  4371.  
  4372. Finally "map_type 5" is a torus or donut shaped mapping.  It assumes that a 
  4373. torus of major radius 1 sits at the origin in the X-Z plane.  The bump 
  4374. pattern is wrapped around similar to spherical or cylindrical maps.  
  4375. However the top and bottom edges of the map wrap over and under the torus 
  4376. where they meet each other on the inner rim.
  4377.  
  4378. Types 3 and 4 are still under development.
  4379.  
  4380. Note: The "map_type" option may also be applied to image_map and 
  4381. material_map statements.
  4382.  
  4383.  
  4384. 5.4.2.6.6   The "interpolate" option.
  4385.  
  4386. Adding the "interpolate" keyword can smooths the jagged look of a bump map.  
  4387. When POV-Ray asks bump amount for a bump map, it often asks for a point 
  4388. that is not directly on top of one pixel, but sort of between several 
  4389. different colored pixels.  Interpolations returns an "in-between" value so 
  4390. that the steps between the pixels in the bump map will look smoother.
  4391.  
  4392. There are currently two types of interpolation:
  4393.  
  4394.    Normalized Distance -- interpolate 4
  4395.    Bilinear            -- interpolate 2
  4396.  
  4397. Default is no interpolation. Normalized distance is the slightly faster of 
  4398. the two, bilinear does a better job of picking the between color. Normally, 
  4399. bilinear is used.
  4400.  
  4401. If your bump map looks jaggy, try using interpolation instead of going to a 
  4402. higher resolution image.  The results can be very good.
  4403.  
  4404.  
  4405. 5.4.2.7     Normal Modifiers
  4406.  
  4407. After specifying the normal type such as bumps, dents etc you may add any 
  4408. of several modifiers.
  4409.  
  4410.  
  4411. 5.4.2.7.1   Turbulence
  4412.  
  4413. The keyword "turbulence" followed by a float or vector may be used to stir 
  4414. up the color pattern.  Typical values range from the default 0.0 which is 
  4415. no turbulence to 1.0 which is very turbulent.  If a vector is specified 
  4416. then different amounts of turbulence is applied in the x, y and z 
  4417. directions.  For example "turbulence <1.0, 0.6, 0.1>" has much turbulence 
  4418. in the x direction, a moderate amount in the y direction and a small amount 
  4419. in the z direction.
  4420.  
  4421. A complete discussion of turbulence is given under Pigment Modifiers in 
  4422. section 5.4.1.5 above.  The "octaves", "omega", and "lambda" options are 
  4423. also available as normal modifiers.  They discussed under that section as 
  4424. well.
  4425.  
  4426.  
  4427. 5.4.2.7.2   Frequency and Phase
  4428.  
  4429. Both waves and ripples respond to a parameter called phase. The phase 
  4430. option allows you to create animations in which the water seems to move. 
  4431. This is done by making the phase increment slowly between frames. The range 
  4432. from 0.0 to 1.0 gives one complete cycle of a wave.
  4433.  
  4434. The waves and ripples textures also respond to a parameter called 
  4435. frequency. If you increase the frequency of the waves, they get closer 
  4436. together. If you decrease it, they get farther apart. 
  4437.  
  4438. Bumps, dents, wrinkles and bump_map do not respond to frequency or phase.
  4439.  
  4440.  
  4441. 5.4.2.7.3   Transforming normals
  4442.  
  4443. You may modify normal patterns with "translate", "rotate" and "scale" 
  4444. commands.  Note that placing these transforms inside the texture but 
  4445. outside the normal will transform the entire texture.  However placing them 
  4446. inside the normal transforms just the normal.  See section 5.4.1.5.7 
  4447. Transforming Pigments for examples:
  4448.  
  4449.  
  4450. 5.4.3 FINISH
  4451.  
  4452. The finish properties of a surface can greatly affect its appearance.  How 
  4453. does light reflect?  What happens when light passes through?  What kind of 
  4454. highlights are visible.  To answer these questions you need a finish 
  4455. statement.
  4456.  
  4457. The "finish {...}" statement is the part of a texture which defines the 
  4458. various finish properties to be applied to an object.  Like the pigment or 
  4459. normal statement, you can omit the surrounding texture block to save 
  4460. typing.  Do not forget however that there is a texture implied. For 
  4461. example...
  4462.  
  4463.  this...                        can be shortened to this...
  4464.  
  4465.   object {                           object {                   
  4466.     My_Object                          My_Object                
  4467.     texture {                          pigment {color Purple} 
  4468.       pigment {color Purple}           finish {phong 0.3}                        
  4469.       finish {phong 0.3}             }
  4470.     }                                  
  4471.   }                                                           
  4472.  
  4473. The most complete form for defining a finish is as follows:
  4474.  
  4475.   finish {
  4476.     FINISH_IDENTIFIER
  4477.     FINISH_ITEMS...
  4478.   }
  4479.  
  4480. The FINISH_IDENTIFIER is optional but should proceed all other items.  Any 
  4481. items after the FINISH_IDENTIFIER modify or override settings given in the 
  4482. IDENTIFIER.  If no identifier is specified then the items modify the finish 
  4483. values in the current default texture.  Note that transformations are not 
  4484. allowed inside a finish because finish items cover the entire surface 
  4485. uniformly.  
  4486.  
  4487.  
  4488. 5.4.3.1     Diffuse Reflection Items
  4489.  
  4490. When light reflects off of a surface, the laws of physics say that it 
  4491. should leave the surface at the exact same angle it came in.  This is 
  4492. similar to the way a billiard ball bounces off a bumper of a pool table.  
  4493. This perfect reflection is called "specular" reflection.  However only very 
  4494. smooth polished surfaces reflect light in this way.  Most of the time, 
  4495. light reflects and is scattered in all directions by the roughness of the 
  4496. surface.  This scattering is called "diffuse reflection" because the light 
  4497. diffuses or spreads in a variety of directions.  It accounts for the 
  4498. majority of the reflected light we see.
  4499.  
  4500. In the real world, light may come from any of three possible sources.  1)It 
  4501. can come directly from actual light sources which are illuminating an 
  4502. object.  2)It can bounce from other objects such as mirrors via specular 
  4503. reflection.  For example shine a flashlight onto a mirror.  3)It can bounce 
  4504. from other objects via diffuse reflections. Look at some dark area under a 
  4505. desk or in a corner.  Even though a lamp may not directly illuminate that 
  4506. spot you can still see a little bit because light comes from diffuse 
  4507. reflection off of nearby objects.
  4508.  
  4509.  
  4510. 5.4.3.1.1   Diffuse
  4511.  
  4512. POV-Ray and most other ray tracers can only simulate directly, one of these 
  4513. three types of illumination.  That is the light which comes directly from 
  4514. the light source which diffuses in all directions.  The keyword "diffuse" 
  4515. is used in a finish statement to control how much light of this direct 
  4516. light is reflected via diffuse reflection.  For example:
  4517.  
  4518.       finish {diffuse 0.7}
  4519.  
  4520. means that 70% of the light seen comes from direct illumination from light 
  4521. sources.  The default value is diffuse 0.6.
  4522.  
  4523.  
  4524. 5.4.3.1.2   Brilliance
  4525.  
  4526. The amount of direct light that diffuses from an object depends upon the 
  4527. angle at which it hits the surface.  When light hits at a shallow angle it 
  4528. illuminates less.  When it is directly above a surface it illuminates more.  
  4529. The "brilliance" keyword can be used in a finish statement to vary the way 
  4530. light falls off depending upon the angle of incidence.  This controls the 
  4531. tightness of the basic diffuse illumination on objects and slightly adjusts 
  4532. the appearance of surface shininess.  Objects may appear more metallic by 
  4533. increasing their brilliance. The default value is 1.0. Higher values from 
  4534. 3.0 to about 10.0 cause the light to fall off less at medium to low angles.  
  4535. There are no limits to the brilliance value. Experiment to see what works 
  4536. best for a particular situation. This is best used in concert with 
  4537. highlighting.
  4538.  
  4539.  
  4540. 5.4.3.1.3   Crand Graininess
  4541.  
  4542. Very rough surfaces, such as concrete or sand, exhibit a dark graininess in 
  4543. their apparent color.  This is caused by the shadows of the pits or holes 
  4544. in the surface.  The "crand" keyword can be added to cause a minor random 
  4545. darkening the diffuse reflection of direct illumination.  Typical values 
  4546. range from "crand 0.01" to "crand 0.5" or higher.  The default value is 0.  
  4547. For example:
  4548.  
  4549.       finish {crand 0.05}
  4550.  
  4551. The grain or noise introduced by this feature is applied on a pixel-by-
  4552. pixel basis.  This means that it will look the same on far away objects as 
  4553. on close objects.  The effect also looks different depending upon the 
  4554. resolution you are using for the rendering.  For these reasons it is not a 
  4555. very accurate way to model the rough surface effect, but some objects still 
  4556. look better with a little crand thrown in.
  4557.  
  4558. In previous versions of POV-Ray there was no "crand" keyword.  Any lone 
  4559. float value found inside a texture{...} which was not preceded by a keyword 
  4560. was interpreted as a randomness value.
  4561.  
  4562. NOTE: This should not be used when rendering animations.  This is the one 
  4563. of a few truly random features in POV-Ray, and will produce an annoying 
  4564. flicker of flying pixels on any textures animated with a "crand" value.
  4565.        
  4566.  
  4567. 5.4.3.1.4   Ambient
  4568.  
  4569. The light you see in dark shadowed areas comes from diffuse reflection off 
  4570. of other objects.  This light cannot be directly modeled using ray tracing.  
  4571. However we can use a trick called "ambient lighting" to simulate the light 
  4572. inside a shadowed area.  
  4573.  
  4574. Ambient light is light that is scattered everywhere in the room. It bounces 
  4575. all over the place and manages to light objects up a bit even where no 
  4576. light is directly shining.  Computing real ambient light would take far too 
  4577. much time, so we simulate ambient light by adding a small amount of white 
  4578. light to each texture whether or not a light is actually shining on that 
  4579. texture.
  4580.  
  4581. This means that the portions of a shape that are completely in shadow will 
  4582. still have a little bit of their surface color. It's almost as if the 
  4583. texture glows, though the ambient light in a texture only affects the shape 
  4584. it is used on. 
  4585.  
  4586. The default value is very little ambient light (0.1). The value can range 
  4587. from 0.0 to 1.0.  Ambient light affects both shadowed and non-shadowed 
  4588. areas so if you turn up the ambient value you may want to turn down the 
  4589. diffuse value.
  4590.  
  4591. Note that this method doesn't account for the color of surrounding objects.  
  4592. If you walk into a room that has red walls, floor and ceiling then your 
  4593. white clothing will look pink from the reflected light.  POV-Ray's ambient 
  4594. shortcut doesn't account for this.  There is also no way to model specular 
  4595. reflected indirect illumination such as the flashlight shining in a mirror.
  4596.  
  4597.  
  4598. 5.4.3.2     Specular Reflection Items
  4599.  
  4600. When light does not diffuse and it DOES reflect at the same angle as it 
  4601. hits an object, it is called "specular reflection".  Such mirror-like 
  4602. reflection is controlled by the "reflection" keyword in a finish statement.  
  4603. For example:
  4604.  
  4605.       finish {reflection 1.0  ambient 0  diffuse 0}
  4606.  
  4607. This gives the object a mirrored finish. It will reflect all other 
  4608. elements in the scene.  The value can range from 0.0 to 1.0. By default 
  4609. there is no reflection.
  4610.  
  4611. Adding reflection to a texture makes it take longer to render because an 
  4612. additional ray must be traced.  
  4613.  
  4614. NOTE: Although such reflection is called "specular" it is not controlled by 
  4615. the POV-Ray "specular" keyword.  That keyword controls a "specular" 
  4616. highlight.
  4617.  
  4618.  
  4619. 5.4.3.3     Highlights
  4620.  
  4621. A highlights are the bright spots that appear when a light source reflects 
  4622. off of a smooth object.  They are a blend of specular reflection and 
  4623. diffuse reflection.  They are specular-like because they depend upon 
  4624. viewing angle and illumination angle.  However they are diffuse-like 
  4625. because some scattering occurs.  In order to exactly model a highlight you 
  4626. would have to calculate specular reflection off of thousands of microscopic 
  4627. bumps called micro facets.  The more that micro facets are facing the 
  4628. viewer, the shinier the object appears, and the tighter the highlights 
  4629. become. POV-Ray uses two different models to simulate highlights without 
  4630. calculating micro facets.  They are the specular and phong models.
  4631.  
  4632. Note that specular and phong highlights are NOT mutually exclusive. It is 
  4633. possible to specify both and they will both take effect. Normally, however, 
  4634. you will only specify one or the other.
  4635.  
  4636.  
  4637. 5.4.3.3.1   Phong Highlights
  4638.  
  4639. The "phong" keyword controls the amount of Phong highlighting on the 
  4640. object.  It causes bright shiny spots on the object that are the color of 
  4641. the light source being reflected.
  4642.  
  4643. The Phong method measures the average of the facets facing in the mirror 
  4644. direction from the light sources to the viewer. 
  4645.  
  4646. Phong's value is typically from 0.0 to 1.0, where 1.0 causes complete 
  4647. saturation to the light source's color at the brightest area (center) of 
  4648. the highlight. The default phong 0.0 gives no highlight.
  4649.  
  4650. The size of the highlight spot is defined by the phong_size value.  The 
  4651. larger the phong_size, the tighter, or smaller, the highlight and the 
  4652. shinier the appearance. The smaller the phong_size, the looser, or larger, 
  4653. the highlight and the less glossy the appearance.
  4654.  
  4655. Typical values range from 1.0 (Very Dull) to 250 (Highly Polished) though 
  4656. any values may be used. Default phong_size is 40 (plastic) if phong_size is 
  4657. not specified.  For example:
  4658.  
  4659.       finish {phong 0.9  phong_size 60}
  4660.  
  4661. If "phong" is not specified then "phong_size" has no effect.
  4662.  
  4663.  
  4664. 5.4.3.3.2   Specular Highlight
  4665.  
  4666. A specular highlight is very similar to Phong highlighting, but uses 
  4667. slightly different model.  The specular model more closely resembles real 
  4668. specular reflection and provides a more credible spreading of the 
  4669. highlights occur near the object horizons. 
  4670.  
  4671. Specular's value is typically from 0.0 to 1.0, where 1.0 causes complete 
  4672. saturation to the light source's color at the brightest area (center) of 
  4673. the highlight. The default specular 0.0 gives no highlight.
  4674.  
  4675. The size of the spot is defined by the value given for roughness.  Typical 
  4676. values range from 1.0 (Very Rough -- large highlight) to 0.0005 (Very 
  4677. Smooth -- small highlight). The default value, if roughness is not 
  4678. specified, is 0.05 (Plastic).
  4679.  
  4680. It is possible to specify "wrong" values for roughness that will generate 
  4681. an error when you try to render the file. Don't use 0 and if you get 
  4682. errors, check to see if you are using a very, very small roughness value 
  4683. that may be causing the error.  For example:
  4684.  
  4685.       finish {specular 0.9  roughness 0.02}
  4686.  
  4687. If "specular" is not specified then "roughness" has no effect.
  4688.  
  4689.  
  4690. 5.4.3.3.3   Metallic Highlight Modifier
  4691.  
  4692. The keyword "metallic" may be used with phong or specular highlights.  This 
  4693. keyword indicates that the color of the highlights will be filtered by the 
  4694. surface color instead of directly using the light_source color. Note that 
  4695. the keyword has no numeric value after it.  You either have it or you 
  4696. don't.  For example:
  4697.  
  4698.       finish {phong 0.9  phong_size 60  metallic}
  4699.  
  4700. If "phong" or "specular" is not specified then "metallic" has no effect.
  4701.  
  4702.  
  4703. 5.4.3.4     Refraction
  4704.  
  4705. When light passes through a surface either into or out of a dense medium, 
  4706. the path of the ray of light is bent.  Such bending is called refraction.  
  4707. Normally transparent or semi-transparent surfaces in POV-Ray do not refract 
  4708. light.  Adding "refraction 1.0" to the finish statement turns on 
  4709. refraction.  
  4710.  
  4711. Note: It is recommended that you only use "refraction 0" or "refraction 1".  
  4712. Values in between will darken the refracted light in ways that do not 
  4713. correspond to any physical property.  Many POV-Ray scenes were created with 
  4714. intermediate refraction values before this "bug" was discovered so the 
  4715. "feature" has been maintained.  A more appropriate way to reduce the 
  4716. brightness of refracted light is to change the "filter" value in the colors 
  4717. specified in the pigment statement.  Note also that "refraction" does not 
  4718. cause the object to be transparent.  Transparency is only occurs if there 
  4719. is a non-zero "filter" value in the color.
  4720.  
  4721. The amount of bending or refracting of light depends upon the density of 
  4722. the material.  Air, water, crystal, diamonds all have different density and 
  4723. thus refract differently.  The "index of refraction" or "ior" value is used 
  4724. by scientists to describe the relative density of substances.  The "ior" 
  4725. keyword is used in POV-Ray to specify the value.  For example:
  4726.  
  4727.       texture {
  4728.         pigment { White filter 0.9 }
  4729.         finish {
  4730.           refraction 1
  4731.           ior 1.5
  4732.         }
  4733.       }
  4734.  
  4735. The default ior value of 1.0 will give no refraction.  The index of 
  4736. refraction for air is 1.0, water is 1.33, glass is 1.5, and diamond is 2.4. 
  4737. The file IOR.INC pre-defines several useful values for ior.
  4738.  
  4739. NOTE: If a texture has a filter component and no value for refraction and 
  4740. ior are supplied, the renderer will simply transmit the ray through the 
  4741. surface with no bending.  In layered textures, the refraction and ior 
  4742. keywords MUST be in the last texture, otherwise they will not take effect.
  4743.  
  4744.  
  4745. 5.4.4 SPECIAL TEXTURES
  4746.  
  4747. Most textures consist of a single pigment, normal and finish specification 
  4748. which applies to the entire surface.  However two special textures have 
  4749. been implemented that extend the "checker" and "image_map" concepts to 
  4750. cover not just pigment but the entire texture.
  4751.  
  4752.  
  4753. 5.4.4.1     Tiles
  4754.  
  4755. This first special texture is the "tiles" texture.  It works just like the 
  4756. "checker" pigment pattern except it colors the blocks with entire textures 
  4757. rather than solid colors.
  4758.  
  4759. The syntax is:
  4760.  
  4761.       texture{
  4762.         tiles {
  4763.           texture {... put in a texture here ... } 
  4764.         tile2
  4765.           texture {... this is the second tile texture } 
  4766.         } 
  4767.        // Optionally put translate, rotate or scale here
  4768.       }
  4769.  
  4770. For example:
  4771.  
  4772.     texture{
  4773.        tiles {
  4774.           texture { Jade }
  4775.        tile2
  4776.           texture { Red_Marble }
  4777.        } 
  4778.     }
  4779.  
  4780. The textures used in each tile may be any type of texture including more 
  4781. tiles or regular textures made from pigment, normal and finish statements.  
  4782. Note that no other pigment, normal or finish statements may be added to the 
  4783. texture.  This is illegal:
  4784.  
  4785.       texture {
  4786.         tiles {
  4787.           texture {T1}
  4788.         tile2
  4789.           texture {T2}
  4790.         }
  4791.         finish {phong 1.0}
  4792.       }
  4793.  
  4794. The finish must be individually added to each texture.
  4795.  
  4796. Note that earlier versions of POV-Ray used only the pigment parts of the 
  4797. textures in the tiles.  Normals and finish were ignored.  Also layered 
  4798. textures were not supported.  In order to correct these problems the above 
  4799. restrictions on syntax were necessary.  This means some POV-Ray 1.0 scenes 
  4800. using tiles many need minor modifications that cannot be done automatically 
  4801. with the version compatibility mode.
  4802.  
  4803. The textures within a tiles texture may be layered but tiles textures do 
  4804. don't work as part of a layered texture.
  4805.  
  4806.  
  4807. 5.4.4.2     Material_Map
  4808.  
  4809. The "material_map" special texture extends the concept of "image_map" to 
  4810. apply to entire textures rather than solid colors.  A material_map allows 
  4811. you to wrap a 2-D bit-mapped texture pattern around your 3-D objects.
  4812.  
  4813. Instead of placing a solid color of the image on the shape like an 
  4814. image_map, an entire texture is specified based on the index or color of 
  4815. the image at that point.  You must specify a list of textures to be used 
  4816. like a "texture palette" rather than the usual color palette.  
  4817.  
  4818. When used with mapped file types such as GIF, the index of the pixel is 
  4819. used as an index into the list of textures you supply.  For unmapped file 
  4820. types such as TGA, the 8 bit value of the red component in the range 0-255 
  4821. is used as an index.  
  4822.  
  4823. If the index of a pixel is greater than the number of textures in your list 
  4824. then the index is taken modulo N where N is the length of your list of 
  4825. textures.  
  4826.  
  4827.  
  4828. 5.4.4.2.1   Specifying a material map.
  4829.  
  4830. The syntax for material_map is...
  4831.  
  4832.       texture {
  4833.         material_map {
  4834.           FILE_TYPE "filename"
  4835.           MODIFIERS...
  4836.           texture {...} // First used for index 0
  4837.           texture {...} // Second texture used for index 1
  4838.           texture {...} // Third texture used for index 2
  4839.           texture {...} // Fourth texture used for index 3
  4840.                         // and so on for however many used.
  4841.         }
  4842.         TRANSFORMATION...
  4843.       }
  4844.  
  4845. If particular index values are not used in an image then it may be 
  4846. necessary to supply dummy textures.  It may be necessary to use a paint 
  4847. program or other utility to examine the map file's palette to determine how 
  4848. to arrange the texture list.
  4849.  
  4850. In the syntax above, FILE_TYPE is one of the following keywords "gif", 
  4851. "tga", "iff" or "dump".  This is followed by the name of the file in 
  4852. quotes.  Several optional modifiers may follow the file specification.  The 
  4853. modifiers are described below.  Note: Earlier versions of POV-Ray allowed 
  4854. some modifiers before the FILE_TYPE but that syntax is being phased out in 
  4855. favor of the syntax described here.
  4856.  
  4857. Filenames specified in the material_map statements will be searched for in 
  4858. the home (current) directory first, and if not found, will then be searched 
  4859. for in directories specified by any "-L" (library path) options active. 
  4860. This would facilitate keeping all your material maps files in a separate 
  4861. subdirectory, and giving an "-L" option on the command line to where your 
  4862. library of material maps are. 
  4863.  
  4864. By default, the material is mapped onto the X-Y plane.  The material is 
  4865. "projected" onto the object as though there were a slide projector 
  4866. somewhere in the -Z direction.  The material exactly fills the square area 
  4867. from x,y coordinates (0,0) to (1,1) regardless of the material's original 
  4868. size in pixels.  If you would like to change this default, you may 
  4869. translate, rotate or scale the normal or texture to map it onto the 
  4870. object's surface as desired. 
  4871.  
  4872. If you would like to change this default orientation, you may translate, 
  4873. rotate or scale the texture to map it onto the object's surface as desired. 
  4874.  
  4875. Note that no other pigment, normal or finish statements may be added to the 
  4876. texture outside the material_map.  This is illegal:
  4877.  
  4878.       texture {
  4879.         material_map {
  4880.           gif "matmap.gif"
  4881.           texture {T1}
  4882.           texture {T2}
  4883.           texture {T3}
  4884.         }
  4885.         finish {phong 1.0}
  4886.       }
  4887.  
  4888. The finish must be individually added to each texture.
  4889.  
  4890. Note that earlier versions of POV-Ray allowed such specifications but they 
  4891. were ignored.  The above restrictions on syntax were necessary for various 
  4892. bug fixes.  This means some POV-Ray 1.0 scenes using material_maps many 
  4893. need minor modifications that cannot be done automatically with the version 
  4894. compatibility mode.
  4895.  
  4896. The textures within a material_map texture may be layered but material_map 
  4897. textures do don't work as part of a layered texture.  To use a layered 
  4898. texture inside a material_map you must declare it as a texture identifier 
  4899. and invoke it in the texture list.
  4900.  
  4901.  
  4902. 5.4.4.2.2   Material_map options.
  4903.  
  4904. The "once" and "map_type" options may be used with material_maps exactly 
  4905. like image_map or bump_map.  The "interpolate" keyword also is allowed but 
  4906. it interpolates the map indices rather than the colors.  In most cases this 
  4907. results in a worse image instead of a better image.  Future versions will 
  4908. fix this problem.
  4909.  
  4910.  
  4911. 5.4.5 LAYERED TEXTURES
  4912.  
  4913. It is possible to create a variety of special effects using layered 
  4914. textures.  A layered texture is one where several textures that are 
  4915. partially transparent are laid one on top of the other to create a more 
  4916. complex texture. The different texture layers show through the transparent 
  4917. portions to create the appearance of one texture that is a combination of 
  4918. several textures.
  4919.  
  4920. You create layered textures by listing two or more textures one right after 
  4921. the other. The last texture listed will be the top layer, the first one 
  4922. listed will be the bottom layer. All textures in a layered texture other 
  4923. than the bottom layer should have some transparency.  For example:
  4924.  
  4925.       object {
  4926.         My_Object
  4927.         texture {T1}  // the bottom layer
  4928.         texture {T2}  // a semi-transparent layer
  4929.         texture {T3}  // the top semi-transparent layer
  4930.       }
  4931.  
  4932. In this example T2 shows only where T3 is transparent and T1 shows only 
  4933. where T2 and T3 are transparent.
  4934.  
  4935. The color of underlying layers is filtered by upper layers but the results 
  4936. do not look exactly like a series of transparent surfaces.  If you had a 
  4937. stack of surfaces with the textures applied to each, the light would be 
  4938. filtered twice: once on the way in as the lower layers are illuminated by 
  4939. filtered light and once on the way out.  Layered textures do not filter the 
  4940. illumination on the way in.  Other parts of the lighting calculations work 
  4941. differently as well.  The result look great and allow for fantastic looking 
  4942. textures but they are simply different from multiple surfaces.  See 
  4943. STONES.INC in the standard include files for some magnificent layered 
  4944. textures.
  4945.  
  4946. Note layered textures must use the "texture{...}" wrapped around any 
  4947. pigment, normal or finish statements.  Do not use multiple pigment, normal 
  4948. or finish statements without putting them inside the texture statement.
  4949.  
  4950. Layered textures may be declared.  For example:
  4951.  
  4952.       #declare Layered_Examp=
  4953.             texture {T1}
  4954.             texture {T2}
  4955.             texture {T3}
  4956.  
  4957. Then invoke it as follows:
  4958.  
  4959.       object {
  4960.         My_Object
  4961.         texture {
  4962.           Layer_Examp
  4963.           // Any pigment, normal or finish here
  4964.           // modifies the bottom layer only.
  4965.         }
  4966.       }
  4967.  
  4968.  
  4969. 5.4.6 DEFAULT TEXTURE
  4970.  
  4971. POV-Ray creates a default texture when it begins processing.  You may 
  4972. change those defaults as described below.  Every time you specify a 
  4973. "texture{...}" statement, POV-Ray creates a copy of the default texture.  
  4974. Anything items you put in the texture statement override the default 
  4975. settings.  If you attach a pigment, normal or finish to an object without 
  4976. any texture statement then POV-Ray checks to see if a texture has already 
  4977. been attached.  If it has a texture then the pigment, normal or finish will 
  4978. modify that existing texture.  If no texture has yet been attached to the 
  4979. object then the default texture is copied and the pigment, normal or finish 
  4980. will modify that texture.
  4981.  
  4982. You may change the default texture, pigment, normal or finish using the 
  4983. language directive "#default {...}" as follows:
  4984.  
  4985.       #default {
  4986.         texture {
  4987.           pigment {...}
  4988.           normal  {...}
  4989.           finish  {...}
  4990.         }
  4991.       }
  4992.  
  4993. Or you may change just part of it like this:
  4994.  
  4995.       #default {
  4996.          pigment {...}
  4997.       }
  4998.  
  4999. This still changes the pigment of the default texture.  At any time there 
  5000. is only one default texture made from the default pigment, normal and 
  5001. finish.  The example above does not make a separate default for pigments 
  5002. alone.  Note: Special textures tiles and material_map may not be used as 
  5003. defaults.
  5004.  
  5005. You may change the defaults several times throughout a scene as you wish.  
  5006. Subsequent #default statements begin with the defaults that were in effect 
  5007. at the time.  If you wish to reset to the original POV-Ray defaults then 
  5008. you should first save them as follows:
  5009.  
  5010.       //At top of file
  5011.       #declare Original_Default = texture {}
  5012.  
  5013. later after changing defaults you may restore it with...
  5014.  
  5015.       #default {texture {Original_Default}}
  5016.  
  5017. If you do not specify a texture for an object then the default texture is 
  5018. attached when the object appears in the scene.  It is not attached when an 
  5019. object is declared.  For example:
  5020.  
  5021.       #declare My_Object=
  5022.         sphere{<0,0,0>,1}  // Default texture not applied
  5023.  
  5024.       object{My_Object}    // Default texture added here
  5025.  
  5026. You may force a default texture to be added by using an empty texture 
  5027. statement as follows:
  5028.  
  5029.       #declare My_Thing=
  5030.         sphere{<0,0,0>,1 texture{}}  // Default texture applied
  5031.  
  5032. The original POV-Ray defaults for all items are given throughout the 
  5033. documentation under each appropriate section.
  5034.  
  5035.  
  5036. 5.5   CAMERA
  5037. ------------
  5038.  
  5039. Every scene in POV-Ray has a camera defined.  If you do not specify a 
  5040. camera then a default camera is used.  The camera definition describes the 
  5041. position, angle and properties of the camera viewing the scene. POV-Ray 
  5042. uses this definition to do a simulation of the camera in the ray tracing 
  5043. universe and "take a picture" of your scene.
  5044.  
  5045. The camera simulated in POV-Ray is a pinhole camera. Pinhole cameras have a 
  5046. fixed focus so all elements of the scene will always be perfectly in focus. 
  5047. The pinhole camera is not able to do soft focus or depth of field effects.
  5048.  
  5049. A total of 6 vectors may be specified to define the camera but only a few 
  5050. of those are needed to in most cases.  Here is an introduction to simple 
  5051. camera placement.
  5052.  
  5053.  
  5054. 5.5.1 LOCATION AND LOOK_AT
  5055.  
  5056. Under many circumstances just two vectors in the camera statement are all 
  5057. you need: location and look_at.  For example:
  5058.  
  5059.       camera {
  5060.         location <3,5,-10>
  5061.         look_at  <0,2,1>
  5062.       }
  5063.  
  5064. The location is simply the X, Y, Z coordinates of the camera. The camera 
  5065. can be located anywhere in the ray tracing universe.  The default location 
  5066. is <0,0,0>.  The look_at vector tells POV-Ray to pan and tilt the camera 
  5067. until it is looking at the specified X, Y, Z coordinate.  By default the 
  5068. camera looks at a point one unit in the +Z direction from the location. 
  5069.  
  5070. The look_at specification should almost always be the LAST item in the 
  5071. camera statement.  If other camera items are placed after the look_at 
  5072. vector then the camera may not continue to look at the specified point.
  5073.  
  5074.  
  5075. 5.5.2 THE SKY VECTOR
  5076.  
  5077. Normally POV-Ray pans left or right by rotating about the Y axis until it 
  5078. lines up with the look_at point and then tilts straight up or down until 
  5079. the point is met exactly.  However you may want to slant the camera 
  5080. sideways like an airplane making a banked turn.  You may change the tilt of 
  5081. the camera using the "sky" vector.  For example:
  5082.  
  5083.       camera {
  5084.         location <3,5,-10>
  5085.         sky      <1,1,0>
  5086.         look_at  <0,2,1>
  5087.       }
  5088.  
  5089. This tells POV-Ray to roll the camera until the top of the camera is in 
  5090. line with the sky vector.  Imagine that the sky vector is an antenna 
  5091. pointing out of the top of the camera.  Then it uses the "sky" vector as 
  5092. the axis of rotation left or right and then to tilt up or down in line with 
  5093. the "sky" vector.  In effect you're telling POV-Ray to assume that the sky 
  5094. isn't straight up.  Note that the sky vector must appear before the look_at 
  5095. vector.  The sky vector does nothing on its own.  It only modifies the way 
  5096. the look_at vector turns the camera.  The default value for sky is <0,1,0>.
  5097.  
  5098.  
  5099. 5.5.3 THE DIRECTION VECTOR
  5100.  
  5101. The "direction" vector serves two purposes.  It tells POV-Ray the initial 
  5102. direction to point the camera before moving it with look_at or rotate 
  5103. vectors.  It also controls the field of view.  
  5104.  
  5105. Note that this is only the initial direction.  Normally, you will use the 
  5106. look_at keyword, not the direction vector to point the camera in its actual 
  5107. direction. 
  5108.  
  5109. The length of the direction vector tells POV-Ray to use a telephoto or 
  5110. wide-angle view.  It is the distance from the camera location to the 
  5111. imaginary "view window" that you are looking through.  A short direction 
  5112. vector gives a wide angle view while a long direction gives a narrow, 
  5113. telephoto view.  
  5114.  
  5115. This figure illustrates the effect:
  5116.  
  5117.                  |\                                            |\   
  5118.                  | \                                           | \  
  5119.                  |  \                                          |  \ 
  5120.                  |   \                                         |   \
  5121.   Location       |   |            Location                     |   |
  5122.       *------------> |                *--------------------------> |
  5123.         Direction|   |                                         |   |
  5124.                  |   |                                         |   |
  5125.                  |   |                                         |   |
  5126.                   \  |                                          \  |
  5127.                    \ |                                           \ |
  5128.                     \|                                            \|
  5129.  
  5130.  
  5131. Short direction gives wide view...        long direction narrows view.
  5132.  
  5133. The default value is "direction <0,0,1>".
  5134.  
  5135. Be careful with short direction vector lengths like 1.0 and less. You may 
  5136. experience distortion on the edges of your images. Objects will appear to 
  5137. be shaped strangely. If this happens, move the location back and make the 
  5138. direction vector longer.
  5139.  
  5140. Wide angle example:
  5141.       camera {
  5142.         location  <3,5,-10>
  5143.         direction <0,0,1>
  5144.         look_at   <0,2,1>
  5145.       }
  5146.  
  5147. Zoomed in telephoto example:
  5148.       camera {
  5149.         location <3,5,-10>
  5150.         direction <0,0,8>
  5151.         look_at  <0,2,1>
  5152.       }
  5153.  
  5154.  
  5155. 5.5.4 UP AND RIGHT VECTORS
  5156.  
  5157. The "up" vector defines the height of the view window.  The "right" vector 
  5158. defines the width of the view window.  This figure illustrates the 
  5159. relationship of these vectors:
  5160.  
  5161.       --------------------------
  5162.      |             ^            |
  5163.      |   up <0,1,0>|            |
  5164.      |             |            |
  5165.      |             |            |
  5166.      |             |            |
  5167.      |             |            |
  5168.      |             |            |
  5169.      |------------------------->|
  5170.      |   right<1.33,0,0>        |
  5171.      |             |            |
  5172.      |             |            |
  5173.      |             |            |
  5174.      |             |            |
  5175.      |             |            |
  5176.      |             |            |
  5177.       --------------------------
  5178.  
  5179.  
  5180. 5.5.4.1     Aspect Ratio
  5181.  
  5182. Together these vectors define the "aspect ratio" (height to width ratio) of 
  5183. the resulting image.  The default values "up <0,1,0>" and "right 
  5184. <1.33,0,0>" results in an aspect ratio of about 4 to 3.  This is the aspect 
  5185. ratio of a typical computer monitor.  If you wanted a tall skinny image or 
  5186. a short wide panoramic image or a perfectly square image then you should 
  5187. adjust the up and right vectors to the appropriate proportions.
  5188.  
  5189. Most computer video modes and graphics printers use perfectly square 
  5190. pixels.  For example Macintosh displays and IBM S-VGA modes 640x480, 
  5191. 800x600 and 1024x768 all use square pixels.  When your intended viewing 
  5192. method uses square pixels then the width and height you set with the +W and 
  5193. +H switches should also have the same ratio as the right and up vectors.  
  5194. Note that 640/480=4/3 so the ratio is proper for this square pixel mode.
  5195.  
  5196. Not all display modes use square pixels however.  For example IBM VGA mode 
  5197. 320x200 and Amiga 320x400 modes do not use square pixels.  These two modes 
  5198. still produce a 4/3 aspect ratio image.  Therefore images intended to be 
  5199. viewed on such hardware should still use 4/3 ratio on their up & right 
  5200. vectors but the +W and +H settings will not be 4/3.
  5201.  
  5202. For example:
  5203.       camera {
  5204.         location <3,5,-10>
  5205.         up       <0,1,0>
  5206.         right    <1,0,0>
  5207.         look_at  <0,2,1>
  5208.       }
  5209.  
  5210. This specifies a perfectly square image.  On a square pixel display like 
  5211. SVGA you would use +W and +H settings such as +W480 +H480 or +W600 +H600.  
  5212. However on the non-square pixel Amiga 320x400 mode you would want to use 
  5213. values of +W240 +H400 to render a square image.
  5214.  
  5215.  
  5216. 5.5.4.2     Handedness
  5217.  
  5218. The "right" vector also describes the direction to the right of the camera. 
  5219. It tells POVg surface is found, 
  5220. then the color is returned as black. Raise max_trace_level if you see black 
  5221. in a reflective surface where there should be a color.
  5222.  
  5223. The other symptom you could see is with transparent objects. For instance, 
  5224. try making a union of concentric spheres with the Cloud_Sky texture on 
  5225. them. Make ten of them in the union with radius's from 1-10 then render the 
  5226. Scene. The image will show the first few spheres correctly, then black. 
  5227. This is because a new level is used every time you pass through a 
  5228. transparent surface.  Raise max_trace_level to fix this problem.  For 
  5229. example:
  5230.  
  5231.       #max_trace_level 20
  5232.  
  5233. Note: Raising max_trace_level will use more memory and time and it could 
  5234. cause the program to crash with a stack overflow error. Values for 
  5235. max_trace_level are not restricted, so it can be set to any number as long 
  5236. as you have the time and memory. 
  5237.  
  5238.  
  5239. 5.6.3 MAX_INTERSECTIONS
  5240.  
  5241. POV-Ray uses a set of internal stacks to collect ray/object intersection 
  5242. points.  The usual maximum number of entries in these "I-Stacks" is 64.  
  5243. Complex scenes may cause these stacks to overflow.  POV-Ray doesn't stop 
  5244. but it may incorrectly render your scene.  When POV-Ray finishes rendering, 
  5245. a number of statistics are displayed.  If you see "I-Stack Overflows" 
  5246. reported in the statistics, you should increase the stack size.  Add a 
  5247. directive to your scene as follows:
  5248.  
  5249.       #max_intersections 200
  5250.  
  5251. If the "I-Stack Overflows" remain, increase this value until they stop.
  5252.  
  5253.  
  5254. 5.6.4 BACKGROUND
  5255.  
  5256. A background color can be specified if desired.  Any ray that doesn't hit 
  5257. an object will be colored with this color.  The default background is 
  5258. black.  The syntax for background is:
  5259.  
  5260.       background { color SkyBlue }
  5261.  
  5262. Using a colored background takes up no extra time for the ray tracer, 
  5263. making it a very economical, although limited, feature. Only solid colors 
  5264. can be specified for a background. Textures cannot be used.  No shadows 
  5265. will be cast on it, which makes it very useful, but at the same time, it 
  5266. has no "roundness", or shading, and can sometimes cause a scene to look 
  5267. "flat".  Use background with restraint.  It's often better, although a bit 
  5268. slower, to use a "sky sphere", but there are times when a solid background 
  5269. is just what you need.
  5270.  
  5271.  
  5272. 5.6.5 THE #VERSION DIRECTIVE
  5273.  
  5274. Although POV-Ray 2.0 has had significant changes to the language over POV-
  5275. Ray 1.0, almost all 1.0 scenes will still work if the compatibility mode is 
  5276. set to 1.0.  The +MV switch described earlier, sets the initial mode.  The 
  5277. default is +MV2.0.  
  5278.  
  5279. Inside a scene file you may turn compatibility off or on using the 
  5280. "#version" directive.  For example:
  5281.  
  5282.       #version 1.0
  5283.       // Put some version 1.0 statements here
  5284.  
  5285.       #version 2.0
  5286.       // Put some version 2.0 statements here
  5287.  
  5288. Note you may not change versions inside an object or declaration.
  5289.  
  5290. The primary purpose of the switch is to turn off float and expression 
  5291. parsing so that commas are not needed.  It also turns off some warning 
  5292. messages.
  5293.  
  5294. Note some changes in tiles and material_maps cannot be fixed by turning the 
  5295. version compatibility on.  It may require hand editing of those statements.  
  5296. See the special texture section for details.
  5297.  
  5298. Future versions of POV-Ray may not continue to maintain full backward 
  5299. compatibility.  We strongly encourage you to phase in 2.0 syntax as much as 
  5300. possible.
  5301.  
  5302.  
  5303. APPENDIX A  COMMON QUESTIONS AND ANSWERS
  5304. ========================================
  5305.  
  5306. Q: I get a floating point error on certain pictures. What's wrong?
  5307.  
  5308. A: The ray tracer performs many thousands of floating point operations when 
  5309. tracing a scene. If checks were added to each one for overflow or 
  5310. underflow, the program would be much slower. If you get this problem, first 
  5311. look through your scene file to make sure you're not doing something like:
  5312.  
  5313. - Scaling something by 0 in any dimension. 
  5314.   Ex: scale <34, 2, 0> will generate a warning.
  5315. - Making the look_at point the same as the location in the camera
  5316. - Looking straight down at the look_at point
  5317. - Defining triangles with two points the same (or nearly the same)
  5318. - Using a roughness value of zero (0).
  5319.  
  5320. If it doesn't seem to be one of these problems, please let us know. If you 
  5321. do have such troubles, you can try to isolate the problem in the input 
  5322. scene file by commenting out objects or groups of objects until you narrow 
  5323. it down to a particular section that fails. Then try commenting out the 
  5324. individual characteristics of the offending object.
  5325.  
  5326.  
  5327. Q: Are planes 2D objects or are they 3D but infinitely thin? 
  5328.  
  5329. A: Neither. Planes are 3D objects that divide the world into two half-
  5330. spaces. The space in the direction of the surface normal is considered 
  5331. outside and the other space is inside. In other words, planes are 3D 
  5332. objects that are infinitely thick. For the plane, plane { y, 0 }, every 
  5333. point with a positive Y value is outside and every point with a negative Y 
  5334. value is inside.
  5335.                             ^
  5336.                             |
  5337.                             |
  5338.                             |  Outside
  5339.                      _______|_______
  5340.                          Inside
  5341.  
  5342. Q: I'd like to go through the program and hand-optimize the assembly code 
  5343. in places to make it faster. What should I optimize? 
  5344.  
  5345. A: Don't bother. With hand optimization, you'd spend a lot of time to get 
  5346. perhaps a 5-10% speed improvement at the cost of total loss of portability. 
  5347. If you use a better ray-surface intersection algorithm, you should be able 
  5348. to get an order of magnitude or more improvement. Check out some books and 
  5349. papers on ray tracing for useful techniques. Specifically, check out 
  5350. "Spatial Subdivision" and "Ray Coherence" techniques.
  5351.  
  5352.  
  5353. Q: Objects on the edges of the screen seem to be distorted. Why? 
  5354.  
  5355. A: If the direction vector of the camera is not very long, you may get 
  5356. distortion at the edges of the screen. Try moving the location back and 
  5357. raising the value of the direction vector. 
  5358.  
  5359.  
  5360. Q: How do you position planar image maps without a lot of trial and error?
  5361.  
  5362. A: By default, images will be mapped onto the range 0,0 to 1,1 in the 
  5363. appropriate plane. You should be able to translate, rotate, and scale the 
  5364. image from there.
  5365.  
  5366.  
  5367. Q: How do you calculate the surface normals for smooth triangles? 
  5368.  
  5369. A:  There are two ways of getting another program to calculate them for 
  5370. you. There are now several utilities to help with this.
  5371.  
  5372. 1) Depending on the type of input to the program, you may be able to 
  5373. calculate the surface normals directly. For example, if you have a program 
  5374. that converts B-Spline or Bezier Spline surfaces into POV-Ray format files, 
  5375. you can calculate the surface normals from the surface equations.
  5376.  
  5377. 2) If your original data was a polygon or triangle mesh, then it's not 
  5378. quite so simple. You have to first calculate the surface normals of all the 
  5379. triangles. This is easy to do - you just use the vector cross-product of 
  5380. two sides (make sure you get the vectors in the right order). Then, for 
  5381. every vertex, you average the surface normals of the triangles that meet at 
  5382. that vertex.  These are the normals you use for smooth triangles. Look for 
  5383. the utilities such as RAW2POV.  RAW2POV has an excellent bounding scheme 
  5384. and the ability to specify a smoothing threshold.
  5385.  
  5386.  
  5387. Q: When I render parts of a picture on different systems, the textures 
  5388. don't match when I put them together. Why?
  5389.  
  5390. A: The appearance of a texture depends on the particular random number 
  5391. generator used on your system. POV-Ray seeds the random number generator 
  5392. with a fixed value when it starts, so the textures will be consistent from 
  5393. one run to another or from one frame to another so long as you use the same 
  5394. executables. Once you change executables, you will likely change the random 
  5395. number generator and, hence, the appearance of the texture. There is an 
  5396. example of a standard ANSI random number generator provided in IBM.C, 
  5397. include it in your machine-specific code if you are having consistency 
  5398. problems.
  5399.  
  5400.  
  5401. Q: I created an object that passes through its bounding volume. At times, I 
  5402. can see the parts of the object that are outside the bounding volume. Why 
  5403. does this happen? 
  5404.  
  5405. A: Bounding volumes are not designed to change the shape of the object. 
  5406. They are strictly a realtime improvement feature. The ray tracer trusts you 
  5407. when you say that the object is enclosed by a bounding volume. The way it 
  5408. uses bounding volumes is very simple: If the ray hits the bounding volume 
  5409. (or the ray's origin is inside the bounding volume),when the object is 
  5410. tested against that ray. Otherwise, we ignore the object. If the object 
  5411. extends beyond the bounding volume, anything goes. The results are 
  5412. undefined. It's quite possible that you could see the object outside the 
  5413. bounding volume and it's also possible that it could be invisible. It all 
  5414. depends on the geometry of the scene. If you want this effect use a 
  5415. clipped_by volume instead of bounded_by or use clipped_by { bounded_by } if 
  5416. you wish to clip and bound with the same object.
  5417.  
  5418.  
  5419. APPENDIX B  TIPS AND HINTS
  5420. ==========================
  5421.  
  5422. B.1   SCENE DESIGN
  5423. ------------------
  5424.  
  5425. There are a number of excellent shareware CAD style modelers available on 
  5426. the DOS platform now that will create POV-Ray scene files.  The online 
  5427. systems mentioned elsewhere in this document are the best places to find 
  5428. these.
  5429.  
  5430. Hundreds of special-purpose utilities have been written for POV-Ray; data 
  5431. conversion programs, object generators, shell-style "launchers", and more. 
  5432. It would not be possible to list them all here, but again, the online 
  5433. systems listed will carry most of them. Most, following the POV-Ray spirit, 
  5434. are freeware or inexpensive shareware.
  5435.  
  5436. Some extremely elaborate scenes have been designed by drafting on graph 
  5437. paper.  Raytracer Mike Miller recommends graph paper with a grid divided in 
  5438. tenths, allowing natural decimal conversions.
  5439.  
  5440. Start out with a "boilerplate" scene file, such as a copy of BASICVUE.POV, 
  5441. and edit that.  In general, place your objects near and around the "origin" 
  5442. (0, 0, 0) with the camera in the negative z direction, looking at the 
  5443. origin.  Naturally, you will break from this rule many times, but when 
  5444. starting out, keep things simple.
  5445.  
  5446. For basic, boring, but dependable lighting, place a light source at or near 
  5447. the position of the camera.  Objects will look flat, but at least you will 
  5448. see them.  From there, you can move it slowly into a better position.
  5449.  
  5450.  
  5451. B.2   SCENE DEBUGGING TIPS
  5452. --------------------------
  5453.  
  5454. To see a quick version of your picture, render it very small. With fewer 
  5455. pixels to calculate the ray tracer can finish more quickly. -w160 -h100 is 
  5456. a good size.
  5457.  
  5458. Use the +Q "quality" switch when appropriate.
  5459.  
  5460. If there is a particular area of your picture that you need to see in high 
  5461. resolution, perhaps with anti-aliasing on (perhaps a fine-grained wood 
  5462. texture), use the +SC, +EC. +SR, and +ER switches to isolate a "window".
  5463.  
  5464. If your image contains a lot of inter-reflections, set max_trace_level to a 
  5465. low value such as 1 or 2.  Don't forget to put it back up when you're 
  5466. finished!
  5467.  
  5468. "Turn off" any unnecessary lights.  Comment out extended light and 
  5469. spotlight keywords when not needed for debugging.  Again, don't forget to 
  5470. put them back in before you retire for the night with a final render 
  5471. running!
  5472.  
  5473. If you've run into an error that is eluding you by visual examination, it's 
  5474. time to start bracketing your file.  Use the block comment characters ( 
  5475. /* ... */ ) to disable most of your scene and try to render again.  If you 
  5476. no longer get an error, the problem naturally lies somewhere within the 
  5477. disabled area.  Slow and methodical testing like this will eventually get 
  5478. you to a point where you will either be able to spot the bug, or go quietly 
  5479. insane.  Maybe both.
  5480.  
  5481. If you seem to have "lost" yourself or an object (a common experience for 
  5482. beginners) there are a few tricks that can sometimes help:
  5483.  
  5484.      1) Move your camera way back to provide a long range view.
  5485.      This may not help with very small objects which tend to
  5486.      be less visible at a distance, but it's a nice trick to keep
  5487.      up your sleeve.
  5488.  
  5489.      2) Try setting the ambient value to 1.0 if you suspect that
  5490.      the object may simply be hidden from the lights.  This will
  5491.      make it self-illuminated and you'll be able to see it even
  5492.      with no lights in the scene.
  5493.  
  5494.      3) Replace the object with a larger, more obvious "stand-in"
  5495.      object like a large sphere or box.  Be sure that all the
  5496.      same transformations are applied to this new shape so that
  5497.      it ends up in the same spot.
  5498.  
  5499.  
  5500. B.3   ANIMATION
  5501. ---------------
  5502.  
  5503. When animating objects with solid textures, the textures must move with the 
  5504. object, i.e. apply the same rotate or translate functions to the texture as 
  5505. to the object itself. This is now done automatically if the transformations 
  5506. are placed _after_ the texture block.
  5507.  
  5508. Example:
  5509.       shape { ...
  5510.         pigment { ... }
  5511.         scale < ... >
  5512.       }
  5513. Will scale the shape and pigment texture by the same amount.
  5514.  
  5515. While:
  5516.       shape { ...
  5517.         scale < ... >
  5518.         pigment { ... }
  5519.       }
  5520. Will scale the shape, but not the pigment.
  5521.  
  5522. Constants can be declared for most of the data types in the program 
  5523. including floats and vectors. By writing these to #include files, you can 
  5524. easily separate the parameters for an animation into a separate file.
  5525.  
  5526. Some examples of declared constants would be:
  5527.    #declare Y_Rotation = 5.0 * clock
  5528.    #declare ObjectRotation = <0, Y_Rotation, 0>
  5529.    #declare MySphere = sphere { <0, 0, 0>, 1.1234 }
  5530.  
  5531. Other examples can be found scattered throughout the sample scene files.
  5532.  
  5533. DOS users: Get ahold of DTA.EXE (Dave's Targa Animator) for 
  5534. creating .FLI/.FLC animations.  AAPLAY.EXE and PLAY.EXE are common viewers 
  5535. for this type of file.
  5536.  
  5537. When moving the camera in an animation (or placing one in a still image, 
  5538. for that matter) avoid placing the camera directly over the origin.  This 
  5539. will cause very strange errors.  Instead, move off center slightly and 
  5540. avoid hovering directly over the scene.
  5541.  
  5542.  
  5543. B.4   TEXTURES
  5544. --------------
  5545.  
  5546. Wood is designed like a "log", with growth rings aligned along the z axis.  
  5547. Generally these will look best when scaled down by about a tenth (to a 
  5548. unit-sized object). Start out with rather small value for the turbulence, 
  5549. too (around 0.05 is good for starters).
  5550.  
  5551. The marble texture is designed around a pigment primitive that is much like 
  5552. an x-gradient.  When turbulated, the effect is different when viewed from 
  5553. the "side" or from the "end".  Try rotating it by 90 degrees on the y axis 
  5554. to see the difference.
  5555.  
  5556. You cannot get specular highlights on a totally black object. Try using a 
  5557. very dark gray, say Gray10 or Gray15, instead.
  5558.  
  5559.  
  5560. B.5   HEIGHT FIELDS
  5561. -------------------
  5562.  
  5563. Try using POV-Ray itself to create images for height_fields:
  5564.  
  5565.       camera { location <0, 0, -2> }
  5566.       plane { z, 0
  5567.          finish { ambient 1 }    // needs no light sources
  5568.          pigment { bozo }        // or whatever.  Experiment.
  5569.       }
  5570.  
  5571. That's all you'll need to create a .tga file that can then be used as a 
  5572. height field in another image!
  5573.  
  5574.  
  5575. B.6   FIELD-OF-VIEW
  5576. -------------------
  5577.  
  5578. By making the direction vector in the camera longer, you can achieve the 
  5579. effect of a tele-photo lens. Shorter direction vectors will give a kind of 
  5580. wide-angle affect, but you may see distortion at the edges of the image.  
  5581. See the file "fov.inc" in the \POVRAY\INCLUDE directory for some predefined
  5582. field-of-view values.
  5583.  
  5584. If your spheres and circles aren't round, try increasing the direction 
  5585. vector slightly.  Often a value of 1.5 works better than the 1.0 default 
  5586. when spheres appear near the edge of the screen.
  5587.  
  5588.  
  5589. B.7   CONVERTING "HANDEDNESS"
  5590. -----------------------------
  5591.  
  5592. If you are importing images from other systems, you may find that the 
  5593. shapes are backwards (left-to-right inverted) and no rotation can make them 
  5594. correct.
  5595.  
  5596. Often, all you have to do is negate the terms in the right vector of the 
  5597. camera to flip the camera left-to-right (use the "right-hand" coordinate 
  5598. system).  Some programs seem to interpret the coordinate systems 
  5599. differently, however, so you may need to experiment with other camera 
  5600. transformations if you want the y and z vectors to work as POV-Ray does.
  5601.  
  5602.  
  5603.  
  5604. APPENDIX C  SUGGESTED READING
  5605. =============================
  5606.  
  5607. First, a shameless plug for two books that are specifically about POV-Ray:
  5608.  
  5609.      The Waite Group's Ray Tracing Creations
  5610.      By Drew Wells & Chris Young
  5611.      ISBN 1-878739-27-1
  5612.      Waite Group Press
  5613.      1993
  5614. and
  5615.      The Waite Group's Image Lab
  5616.      By Tim Wegner
  5617.      ISBN 1-878739-11-5
  5618.      Waite Group Press
  5619.      1992
  5620.  
  5621. Image Lab by Tim Wegner contains a chapter about POV-Ray. Tim is the co-
  5622. author of the best selling book, Fractal Creations, also from the Waite 
  5623. Group. 
  5624.  
  5625. Ray Tracing Creations by Drew Wells and Chris Young is an entire book about 
  5626. ray tracing with POV-Ray. 
  5627.  
  5628. This section lists several good books or periodicals that you should be 
  5629. able to locate in your local computer book store or your local university 
  5630. library. 
  5631.  
  5632.     "An Introduction to Ray tracing"
  5633.     Andrew S. Glassner (editor)
  5634.     ISBN 0-12-286160-4
  5635.     Academic Press
  5636.     1989
  5637.  
  5638.     "3D Artist" Newsletter
  5639.     ("The Only Newsletter about Affordable 
  5640.       PC 3D Tools and Techniques")
  5641.     Publisher: Bill Allen
  5642.     P.O. Box 4787
  5643.     Santa Fe, NM 87502-4787
  5644.     (505) 982-3532
  5645.  
  5646.     "Image Synthesis:  Theory and Practice"
  5647.     Nadia Magnenat-Thalman and Daniel Thalmann
  5648.     Springer-Verlag
  5649.     1987
  5650.  
  5651.     "The RenderMan Companion"
  5652.     Steve Upstill
  5653.     Addison Wesley
  5654.     1989
  5655.  
  5656.     "Graphics Gems"
  5657.     Andrew S. Glassner (editor)
  5658.     Academic Press
  5659.     1990
  5660.  
  5661.     "Fundamentals of Interactive Computer Graphics"
  5662.     J. D. Foley and A. Van Dam
  5663.     ISBN 0-201-14468-9
  5664.     Addison-Wesley
  5665.     1983
  5666.  
  5667.     "Computer Graphics:  Principles and Practice (2nd Ed.)" 
  5668.     J. D. Foley, A. van Dam, J. F. Hughes
  5669.     ISBN 0-201-12110-7
  5670.     Addison-Wesley,
  5671.     1990
  5672.  
  5673.     "Computers, Pattern, Chaos, and Beauty"
  5674.     Clifford Pickover
  5675.     St. Martin's Press
  5676.  
  5677.     "SIGGRAPH Conference Proceedings"
  5678.     Association for Computing Machinery
  5679.     Special Interest Group on Computer Graphics
  5680.  
  5681.     "IEEE Computer Graphics and Applications"
  5682.     The Computer Society
  5683.     10662, Los Vaqueros Circle
  5684.     Los Alamitos, CA 90720
  5685.  
  5686.     "The CRC Handbook of Mathematical Curves and Surfaces"
  5687.     David von Seggern
  5688.     CRC Press
  5689.     1990
  5690.  
  5691.     "The CRC Handbook of Standard Mathematical Tables"
  5692.     CRC Press
  5693.     The Beginning of Time
  5694.  
  5695.  
  5696. APPENDIX D  LEGAL INFORMATION
  5697. =============================
  5698.  
  5699. The following is legal information pertaining to the use of the Persistence 
  5700. of Vision Ray Tracer a.k.a POV-Ray. It applies to all POV-Ray source files,  
  5701. executable (binary) files, scene files, documentation files contained in 
  5702. the official POV archives.  (Certain portions refer to custom versions of 
  5703. the software,  there are specific rules listed below for these versions 
  5704. also.)  All of these are referred to here as "the software". 
  5705.  
  5706. THIS NOTICE MUST ACCOMPANY ALL OFFICIAL OR CUSTOM PERSISTENCE OF VISION 
  5707. FILES. IT MAY NOT BE REMOVED OR MODIFIED. THIS INFORMATION PERTAINS TO ALL 
  5708. USE OF THE PACKAGE WORLDWIDE.  THIS DOCUMENT SUPERSEDES ALL PREVIOUS 
  5709. LICENSES OR DISTRIBUTION POLICIES.
  5710.  
  5711.  
  5712.                         IMPORTANT LEGAL INFORMATION
  5713.  
  5714. Permission is granted to the user to use the Persistence of Vision 
  5715. Raytracer and all associated files in this package to create and render 
  5716. images. The use of this software for the purpose of creating images is 
  5717. free. The creator of a scene file and the image created from the scene 
  5718. file, retains all rights to the image and scene file they created and may 
  5719. use them for any purpose commercial or non-commercial.  
  5720.  
  5721. The user is also granted the right to use the scenes files and include 
  5722. files distributed in the INCLUDE and DEMO sub-directories of the POVDOC 
  5723. archive when creating their own scenes.  Such permission does not extend to 
  5724. files in the POVSCN archive.  POVSCN files are for your enjoyment and 
  5725. education but may not be the basis of any derivative works.
  5726.  
  5727. This software package and all of the files in this archive are copyrighted 
  5728. and may only be distributed and/or modified according to the guidelines 
  5729. listed below.  The spirit of the guidelines below is to promote POV-Ray as 
  5730. a standard ray tracer, provide the full POV-Ray package freely to as many 
  5731. users as possible, prevent POV-Ray users and developers from being taken 
  5732. advantage of, enhance the life quality of those who come in contact with 
  5733. POV-Ray.  This legal document was created so these goals could be realized.  
  5734. You are legally bound to follow these rules, but we hope you will follow 
  5735. them as a matter of ethics, rather than fear of litigation.
  5736.  
  5737. No portion of this package may be separated from the package and 
  5738. distributed separately other than under the conditions specified in the 
  5739. guidelines below.  
  5740.  
  5741. This software may be bundled in other software packages according to the 
  5742. conditions specified in the guidelines below.
  5743.  
  5744. This software may be included in software-only compilations using media 
  5745. such as, but not limited to, floppy disk, CD-ROM, tape backup, optical 
  5746. disks, hard disks, or memory cards.  There are specific rules and 
  5747. guidelines listed below for the provider to follow in order to legally 
  5748. offer POV-Ray with a software compilation.
  5749.  
  5750. The user is granted the privilege to modify and compile the source for 
  5751. their own personal use in any fashion they see fit.  What you do with the 
  5752. software in your own home is your business.
  5753.  
  5754. If the user wishes to distribute a modified version of the software (here 
  5755. after referred to as a "custom version") they must follow the guidelines 
  5756. listed below.  These guidelines have been established to promote the growth 
  5757. of POV-Ray and prevent difficulties for users and developers alike.  Please 
  5758. follow them carefully for the benefit of all concerned when creating a 
  5759. custom version.  
  5760.  
  5761. You may not incorporate any portion of the POV-Ray source code in any 
  5762. software other than a custom version of POV-Ray.  However authors who 
  5763. contribute source to POV-Ray may still retain all rights to use their 
  5764. contributed code for any purpose as described below.
  5765.  
  5766. The user is encouraged to send enhancements and bug fixes to the POV-Team, 
  5767. but the team is in no way required to utilize these enhancements or fixes.  
  5768. By sending material to the POV-Team, the contributor asserts that he owns 
  5769. the materials or has the right to distribute these materials.  He 
  5770. authorizes the POV-Team to use the materials any way they like.  The 
  5771. contributor still retains rights to the donated material, but by donating 
  5772. you grant equal rights to the POV-Team.  The POV-Team doesn't have to use 
  5773. the material, but if we do, you do not acquire any rights related to POV-
  5774. Ray.  We will give you credit if applicable.
  5775.  
  5776.  
  5777.                     GENERAL RULES FOR ALL DISTRIBUTION
  5778.  
  5779. The permission to distribute this package under certain very specific 
  5780. conditions is granted in advance, provided that the above and following 
  5781. conditions are met.
  5782.  
  5783. These archives must not be re-archived using a different method without the 
  5784. explicit permission of the POV-Team.  You may rename the archives only to 
  5785. meet the file name conventions of your system or to avoid file name 
  5786. duplications but we ask that you try to keep file names as similar to the 
  5787. originals as possible.  (For example:POVDOC.ZIP to POVDOC20.ZIP)
  5788.  
  5789. You must distribute a full package of archives as described in the next 
  5790. section.
  5791.  
  5792. Non-commercial distribution (such as a user copying the software for a 
  5793. personal friend or colleague and not charging money or services for that 
  5794. copy) has no other restrictions.  This does not include non-profit 
  5795. organizations or computer clubs. These groups should use the 
  5796. Shareware/Freeware distribution company rules below.
  5797.  
  5798. The POV-Team reserves the right to withdraw distribution privileges from 
  5799. any group, individual, or organization for any reason.
  5800.  
  5801.  
  5802.                        DEFINITION OF "FULL PACKAGE"
  5803.  
  5804. POV-Ray is contained in 4 archives for each hardware platform.  1) An 
  5805. executable archive, 2) A documentation archive, 3) Sample scene archives, 
  5806. 4) Source code archive.
  5807.  
  5808. A "full package" is defined as one of the following bundle options:
  5809.    1  All archives (executable, docs, scenes, source)
  5810.    2  User archives (executable, docs, scenes but no source)
  5811.    3  Programmer archives (source, docs, scenes but no executable)
  5812.  
  5813. POV-Ray is officially distributed for IBM-PC compatibles running MS-Dos; 
  5814. Apple Macintosh; and Commodore Amiga.  Other systems may be added in the 
  5815. future.
  5816.  
  5817. Distributors need not support all platforms but for each platform you 
  5818. support you must distribute a full package.  For example an IBM-only BBS 
  5819. need not distribute the Mac versions.
  5820.  
  5821.  
  5822.               CONDITIONS FOR DISTRIBUTION OF CUSTOM VERSIONS
  5823.  
  5824. You may distribute custom compiled versions only if you comply with the 
  5825. following conditions.
  5826.  
  5827.      Mark your version clearly on all modified files stating this to be a 
  5828. modified and unofficial version.
  5829.      Make all of your modifications to POV-Ray freely and publicly 
  5830. available.
  5831.      You must provide all POV-Ray support for all users who use your custom 
  5832. version.  The POV-Ray Team is not obligated to provide you or your users 
  5833. any technical support.
  5834.      You must provide documentation for any and all modifications that you 
  5835. have made to the program that you are distributing.
  5836.      Include clear and obvious information on how to obtain the official 
  5837. POV-Ray.
  5838.      Include contact and support information for your version.  Include 
  5839. this information in the DISTRIBUTION_MESSAGE macros in the source file 
  5840. FRAME.H and insure that the program prominently displays this information.  
  5841. Include all credits and credit screens for the official version.
  5842.      Include a copy of this document.
  5843.  
  5844.  
  5845.                     CONDITIONS FOR COMMERCIAL BUNDLING
  5846.  
  5847. Vendors wishing to bundle POV-Ray with commercial software or with 
  5848. publications must first obtain explicit permission from the POV-Ray Team.  
  5849. This includes any commercial software or publications, such as, but not 
  5850. limited to, magazines, books, newspapers, or newsletters in print or 
  5851. machine readable form.
  5852.  
  5853. The POV-Ray Team will decide if such distribution will be allowed on a 
  5854. case-by-case basis and may impose certain restrictions as it sees fit.  The 
  5855. minimum terms are given below. Other conditions may be imposed.
  5856.  
  5857.      Purchasers of your product must not be led to believe that they are
  5858. paying for POV-Ray.  Any mention of the POV-Ray bundle on the box, in
  5859. advertising or in instruction manuals must be clearly marked with a
  5860. disclaimer that POV-Ray is free software and can be obtained for free or
  5861. nominal cost from various sources.
  5862.      Include clear and obvious information on how to obtain the official
  5863. POV-Ray.
  5864.      Include a copy of this document.
  5865.      You must provide all POV-Ray support for all users who acquired POV-
  5866. Ray through your product.  The POV-Ray Team is not obligated to provide you
  5867. or your customers any technical support.
  5868.      Include a credit page or pages in your documentation for POV-Ray.
  5869.      If you modify any portion POV-Ray for use with your hardware or
  5870. software, you must follow the custom version rules in addition to these
  5871. rules.
  5872.      Include contact and support information for your product.
  5873.      Must include official documentation with product.
  5874.  
  5875.  
  5876.          CONDITIONS FOR SHAREWARE/FREEWARE DISTRIBUTION COMPANIES
  5877.  
  5878. Shareware and freeware distribution companies may distribute the archives 
  5879. under the conditions following this section. 
  5880.  
  5881. You must notify us that you are distributing POV-Ray and must provide us 
  5882. with information on how to contact you should any support issues arise. 
  5883.  
  5884. No more than five dollars U.S. ($5) can be charged per disk for the copying 
  5885. of this software and the media it is provided on. Space on each disk must 
  5886. used completely.  The company may not put each archive on a separate disk 
  5887. and charge for three disks if all three archives will fit on one disk. If 
  5888. more than one disk is needed to store the archives then more than one disk 
  5889. may be used and charged for.
  5890.  
  5891. Distribution on high volume media such as backup tape or CD-ROM is 
  5892. permitted if the total cost to the user is no more than $0.10 per megabyte 
  5893. of data.  For example a CD-ROM with 600 meg could cost no more than $60.00.
  5894.  
  5895.  
  5896.                  CONDITIONS FOR ON-LINE SERVICES AND BBS'S
  5897.  
  5898. On-line services and BBS's may distribute the POV-Ray archives under the 
  5899. conditions following this section. 
  5900.  
  5901. The archives must be all be easily available on the service and should be 
  5902. grouped together in a similar on-line area.  
  5903.  
  5904. It is strongly requested that BBS operators remove prior versions of POV-
  5905. Ray to avoid user confusion and simplify or minimize our support efforts.
  5906.  
  5907. The on-line service or BBS may only charge standard usage rates for the 
  5908. downloading of this software. A premium may not be charged for this 
  5909. package. I.E. CompuServe or America On-Line may make these archives 
  5910. available to their users, but they may only charge regular usage rates for 
  5911. the time required to download. They must also make the all of the archives 
  5912. available in the same forum, so they can be easily located by a user.
  5913.  
  5914.                                 DISCLAIMER
  5915.  
  5916. This software is provided as is without any guarantees or warranty.  
  5917. Although the authors have attempted to find and correct any bugs in the 
  5918. package, they are not responsible for any damage or losses of any kind 
  5919. caused by the use or misuse of the package. The authors are under no 
  5920. obligation to provide service, corrections, or upgrades to this package.
  5921.  
  5922.  
  5923. APPENDIX E  CONTACTING THE AUTHORS
  5924. ==================================
  5925.  
  5926. We love to hear about how you're using and enjoying the program. We also 
  5927. will do our best try to solve any problems you have with POV-Ray and 
  5928. incorporate good suggestions into the program.
  5929.  
  5930. If you have a question regarding commercial use of, distribution of, or 
  5931. anything particularly sticky, please contact Chris Young, the development 
  5932. team coordinator. Otherwise, spread the mail around. We all love to hear 
  5933. from you!
  5934.  
  5935. The best method of contact is e-mail through CompuServe for most of us. 
  5936. America On-Line and Internet can now send mail to CompuServe, also, just 
  5937. use the Internet address and the mail will be sent through to CompuServe 
  5938. where we read our mail daily. 
  5939.  
  5940. Please do not send large files to us through the e-mail without asking 
  5941. first. We pay for each minute on CompuServe and large files can get 
  5942. expensive. Send a query before you send the file, thanks!
  5943.  
  5944. Chris Young
  5945. (Team Coordinator. Worked on everything.)
  5946. CIS: 76702,1655
  5947. Internet 76702.1655@compuserve.com
  5948. US Mail:
  5949.   3119 Cossell Drive
  5950.   Indianapolis, IN 46224 U.S.A.
  5951.  
  5952.  
  5953. Drew Wells 
  5954. (Former team leader. Worked on everything.)
  5955. CIS: 73767,1244
  5956. Internet: 73767.1244@compuserve.com
  5957. AOL: Drew Wells
  5958. Prodigy: SXNX74A (Not used often)
  5959.  
  5960.  
  5961. Other authors and contributors in alphabetical order:
  5962. -----------------------------------------------------
  5963. David Buck
  5964. (Original author of DKBTrace)
  5965. (Primary developer, quadrics, docs)
  5966. INTERNET:(preferred) dbuck@ccs.carleton.ca
  5967. CIS: 70521,1371
  5968.  
  5969. Aaron Collins
  5970. (Co-author of DKBTrace 2.12)
  5971. (Primary developer, IBM-PC display code,phong) 
  5972. CIS: 70324,3200
  5973.  
  5974. Alexander Enzmann
  5975. (Primary developer, Blobs, quartics, boxes, spotlights) 
  5976. CIS: 70323,2461
  5977. INTERNET: xander@mitre.com
  5978.  
  5979. Dan Farmer
  5980. (Primary developer, docs, scene files)
  5981. CIS:70703,1632
  5982.  
  5983. Douglas Muir
  5984. (Bump maps and height fields)
  5985. CIS: 76207,662
  5986. Internet:dmuir@media-lab.media.mit.edu
  5987.  
  5988. Bill Pulver
  5989. (Time code and IBM-PC compile)
  5990. CIS: 70405,1152
  5991.  
  5992. Charles Marslette
  5993. (IBM-PC display code)
  5994. CIS: 75300,1636
  5995.  
  5996. Mike Miller
  5997. (Artist, scene files, stones.inc)
  5998. CIS: 70353,100
  5999.  
  6000. Jim Nitchals
  6001. (Mac version, scene files)
  6002. CIS: 73117,3020
  6003. AppleLink: jimn8
  6004. Internet: 73117.3020@compuserve.com
  6005.  
  6006. Eduard Schwan
  6007. (Mac version, docs)
  6008. CIS: 71513,2161
  6009. AppleLink: JL.Tech
  6010. Internet: 71513.2161@compuserve.com
  6011.  
  6012. Randy Antler
  6013. (IBM-PC display code enhancements)
  6014. CIS: 71511,1015
  6015.  
  6016. David Harr
  6017. (Mac balloon help)
  6018. CIS: 72117,1704
  6019.  
  6020. Scott Taylor
  6021. (Leopard and Onion textures)
  6022. CIS: 72401,410
  6023.  
  6024. Chris Cason
  6025. (colour X-Windows display code)
  6026. CIS: 100032,1644
  6027.  
  6028. Dave Park 
  6029. (Amiga support; added AGA video code)
  6030. CIS: 70004,1764
  6031.